From 764738b015f7898a65298d0df90efad8d0d33852 Mon Sep 17 00:00:00 2001 From: Justin Paul Date: Fri, 25 Feb 2022 09:17:43 -0500 Subject: [PATCH 1/2] Squashed commit of the following: commit a2d724a54c4f5a0ad095c12868a770f4b8a63c48 Merge: a22d9e3 f06157c Author: Wes Carroll Date: Wed Dec 16 13:14:46 2020 -0500 Merge pull request #114 from ZertoPublic/wcarroll/where-fix Wcarroll/where fix commit f06157c75e8feee6d218146c4ff22b47ca61487e Author: Wes Carroll Date: Wed Dec 16 13:10:02 2020 -0500 Bump Version for Release commit d413374c099fb2b414ae19bf44dff555b113ef3d Author: Wes Carroll Date: Wed Dec 16 09:43:22 2020 -0500 CHANGLOG Updates commit 1513cd4f4b14cf450655b5734a02f366ee8a09e9 Author: Wes Carroll Date: Wed Dec 16 09:42:48 2020 -0500 Update Synopsis commit 1daac508b222b4228426024723567b10b8790ca1 Author: Wes Carroll Date: Wed Dec 16 09:42:23 2020 -0500 Update SiteId Lookup Method commit a22d9e3416fa769b05a581edb3722568a0fdfc83 Merge: 912bca0 06e81b4 Author: Wes Carroll Date: Wed Dec 9 21:57:36 2020 -0500 Merge pull request #113 from ZertoPublic/wcarroll/issue112 SiteId Query to VirtualizationSites Fixes #112 commit 06e81b46d690d5de3a04106fbbb7cf38947867b6 Author: Wes Carroll Date: Wed Dec 9 17:09:53 2020 -0500 Update CHANGELOG for #112 commit af33715f02dd1886c30f60fc3f7a281b75a3ba23 Author: Wes Carroll Date: Wed Dec 9 16:13:50 2020 -0500 SiteId Query to VirtualizationSites Fixes #112 commit 912bca0f9cd7cc6e215d7230f7f3a82df2ebb51b Merge: 50e03b3 4ac9516 Author: Wes Carroll Date: Mon Oct 19 19:10:37 2020 -0400 Merge pull request #111 from ZertoPublic/export_bug_fix Export bug fix commit 4ac951607bc7ba06d4c58efa656b4aed8d6eda29 Author: Wes Carroll Date: Mon Oct 19 18:43:13 2020 -0400 Add required Mock commit d3d01f892f685929e2fb687600a2bfcd71ea8d4b Author: Wes Carroll Date: Mon Oct 19 18:35:30 2020 -0400 Bump Version commit 84b79221569b7b10f3da008f202cc3872a439e5f Author: Wes Carroll Date: Mon Oct 19 18:24:08 2020 -0400 Update CHANGELOG commit 0eaf89608be745252bc57f07132482764d39e9f2 Author: Wes Carroll Date: Mon Oct 19 18:22:10 2020 -0400 Clean up VPG Settings Identifier commit 50e03b36f50a3afe36e73be63062b437cea870e5 Merge: a5a91fe 4531d2d Author: Wes Carroll Date: Tue Sep 8 08:55:07 2020 -0400 Merge pull request #110 from ZertoPublic/Release Release into Master commit 4531d2d53bfd792e4933f3f22967cba476fa5a17 Merge: 9dc9aa9 e6e6be9 Author: Wes Carroll Date: Tue Sep 8 08:22:32 2020 -0400 Merge branch 'release_prep' into Release commit e6e6be9eded0b209d547a15b18412764a7eaa7c9 Author: Wes Carroll Date: Tue Sep 8 08:21:10 2020 -0400 Bump Version commit 5c2dd620d88a09e5fbf9a3e725fbe8cf8990e981 Author: Wes Carroll Date: Tue Sep 8 08:20:29 2020 -0400 Update for Release Notes commit a5a91febcf82f73924b34f4185c4672c9a9351ff Merge: ddee165 bb5dbaa Author: Wes Carroll Date: Fri Sep 4 10:28:45 2020 -0400 Merge pull request #109 from jonsouzerto/master Fixed issue 108 commit bb5dbaa0d46c2a3cf63d3c6f5f504e5ada1a811a Author: jonsouzerto <57370019+jonsouzerto@users.noreply.github.com> Date: Thu Sep 3 12:50:49 2020 -0400 Update CHANGELOG.md Added fix information commit e6b5777e64f33f41e246dcf509a1501cd1dfdbcc Author: jonsouzerto <57370019+jonsouzerto@users.noreply.github.com> Date: Thu Sep 3 12:45:35 2020 -0400 Updated recovery host key Attempting to resolve issue 108 commit ddee165575b3d5e8e82fdc294990f445c1d29ac3 Merge: 682750f f027963 Author: Wes Carroll Date: Fri Aug 28 13:48:34 2020 -0400 Merge pull request #107 from gdbarron/invoke-move-updates Invoke-ZertoMove parameter, pipeline, and restructuring updates commit f0279633dd86a521b6fdad365afdc9e6285374b9 Author: Brownstein Date: Fri Aug 28 13:43:22 2020 -0400 add missing .IsPresent for switch value commit 139e52f3e27f85bb41261dfe8de38d0ee327fcf9 Author: Brownstein Date: Thu Aug 27 15:28:01 2020 -0400 add new parameter to test commit eea6e959881ee1ca0d772f4c187f89cabb445c5f Author: Brownstein Date: Thu Aug 27 15:08:28 2020 -0400 update test and help files commit 0630cbb20e0c9ccb512a26f01575b02c7dec2065 Author: Brownstein Date: Fri Aug 21 21:04:15 2020 -0400 new param sets, pipeline input commit 682750fc6dcc21884c48fd34034d8f25dbcbe4d9 Merge: 23e0b8a 9dc9aa9 Author: Wes Carroll Date: Thu Aug 20 13:44:03 2020 -0400 Merge pull request #106 from ZertoPublic/Release Merge pull request #105 from ZertoPublic/master commit 9dc9aa92d0614780722ab3b1184855eced8206bc Merge: dbde9aa 23e0b8a Author: Wes Carroll Date: Thu Aug 20 13:31:28 2020 -0400 Merge pull request #105 from ZertoPublic/master Release 1.5.0 commit 23e0b8a6652413bd33acdd39f5f31b79d2b97d51 Author: Wes Carroll Date: Thu Aug 20 13:25:37 2020 -0400 Prepping for next release commit ae53dcd4d23f4af77a0d82a57baac7a5bcc2dc8b Merge: cb528df ced5671 Author: Wes Carroll Date: Thu Aug 20 12:39:21 2020 -0400 Merge pull request #104 from ZertoPublic/wcarroll/issue103 Update target host validation commit ced5671ab2868fc77320a8fe40779b5422da4b91 Author: Wes Carroll Date: Thu Aug 20 12:29:40 2020 -0400 Update target host validation commit cb528df3d4556b03b56d356ee17b6913d7e2c093 Merge: dbde9aa c91d53e Author: Wes Carroll Date: Wed Aug 5 09:41:09 2020 -0400 Merge pull request #102 from ZertoPublic/Add-VMToVpg Add-ZertoVpgVm and Remove-ZertoVpgVm commit c91d53ecad0e0967bb4a9529f89c947c7bf85b05 Author: Wes Carroll Date: Wed Aug 5 09:34:35 2020 -0400 Update with changes commit 8d8cb58558819f19c0110d0f4df3a43c5d1c662d Author: Wes Carroll Date: Wed Aug 5 08:47:17 2020 -0400 Remove-ZertoVpgVm Tests commit 2dad34754474c80152632a4e2203eee51b57ca9a Author: Wes Carroll Date: Wed Aug 5 08:41:55 2020 -0400 Remove-ZertoVpgVm Help commit 6f798fd96af45fd706ee39e20f9980b887a284c0 Author: Wes Carroll Date: Wed Aug 5 08:22:19 2020 -0400 Update VM Filter Method commit 649e7413a7ec7d7b7d49212f9187fc8eeeeb12d3 Author: Wes Carroll Date: Wed Aug 5 07:46:11 2020 -0400 Fix URL typo commit af6e81267bcff49e586521e08fc397d44f083936 Author: Wes Carroll Date: Wed Aug 5 07:45:55 2020 -0400 Add Online Help URI commit b6d8083b69c31954d876490a446410114aa6b159 Author: Wes Carroll Date: Tue Aug 4 22:05:35 2020 -0400 Remove-ZertoVpgVm update commit 9d4b4d353384a49e171a631ecb2a62b2027d67b4 Author: Wes Carroll Date: Tue Aug 4 17:42:37 2020 -0400 Starting Remove-VpgVm commit 510f0b9ed780240b8c8c01c2234db57d4b1dc7b9 Author: Wes Carroll Date: Tue Aug 4 12:31:37 2020 -0400 Add-ZertoVpgVm Tests commit 9561936be7ebd02e24111028477b2732da44b910 Author: Wes Carroll Date: Tue Aug 4 11:46:12 2020 -0400 Update Help Files commit 961eafb945d963cfdb40fd31cb45228662bddbca Author: Wes Carroll Date: Tue Aug 4 11:44:36 2020 -0400 Update Event Documentation commit aa73534d7ffd55aaf6362b0666a420e4446ea3bd Author: Wes Carroll Date: Tue Aug 4 11:42:41 2020 -0400 Create Add-ZertoVpgVm Help File commit 56bbe59ea77ce766fed6bb8f7baed6217f92d22a Author: Wes Carroll Date: Tue Aug 4 11:23:37 2020 -0400 Always return the Vpg Settings Identifier commit 5f786775dcadb0e2c849a5a5939bc24901753719 Author: Wes Carroll Date: Tue Aug 4 11:23:20 2020 -0400 Verbose Output - VM and VPG name commit 14ef5048e475dcb70db7ff33505014a632f33e8a Author: Wes Carroll Date: Tue Aug 4 11:22:45 2020 -0400 Only process unique VM names commit d7e46bd2634ab63736f05b6d359323c950c656d6 Author: Wes Carroll Date: Tue Aug 4 10:48:58 2020 -0400 Check for existence of Vpg commit c64c82f8bcd937d7d2b10be9b7e5f6c812541a89 Author: Wes Carroll Date: Tue Aug 4 07:53:15 2020 -0400 Add parameter alias commit a59feb2d5fba1b308055f0b7b509d9f45b65afd0 Author: Wes Carroll Date: Mon Aug 3 21:21:05 2020 -0400 Add switch for vpgName commit d9e1063654794ade3e56b69ee51b2ac6f893dccb Author: Wes Carroll Date: Mon Aug 3 21:13:38 2020 -0400 update GitIgnore commit d9e6c74f27b82849983d4a99c21d6435252680c4 Author: Wes Carroll Date: Fri Jul 31 18:02:00 2020 -0400 Add parameter aliases commit df82bc26caac86d0e8baf21daa9990c96d07573f Author: Wes Carroll Date: Fri Jul 31 17:42:28 2020 -0400 Add function Add-ZertoVpgVm commit dbde9aa4c208d42315b31d177dac8b152ed1feee Merge: 291aae9 7dcb653 Author: Wes Carroll Date: Wed Jul 8 13:14:52 2020 -0400 Merge pull request #101 from ZertoPublic/master Merge Current Master to Release Branch commit 7dcb6539a5bc460018bb0c48de44bdf6b21df04d Merge: 5b4a25b 3621dde Author: Wes Carroll Date: Wed Jul 8 13:10:34 2020 -0400 Merge pull request #100 from ZertoPublic/wcarroll/prep_release Prep Release Information commit 3621ddef8dedc44fa53c26e3ac5943fed8080fa8 Author: Wes Carroll Date: Wed Jul 8 13:08:49 2020 -0400 Set Version Numbers commit 5b4a25b66df8b74c1a7e7ca10e45c53e355ec50e Merge: 0872f1a 5a2c013 Author: Wes Carroll Date: Mon Jul 6 14:45:37 2020 -0400 Merge pull request #98 from ZertoPublic:wcarroll/issue95 Remove zvmLocalInfo Script Scope Variable commit 5a2c01341ce3553c736a9d0c6d17f945a4f00d6e Author: Wes Carroll Date: Mon Jul 6 14:32:32 2020 -0400 Update Changlog for Issue 95 commit c477d40364a591583e7f697f4eccf521151fa287 Author: Wes Carroll Date: Mon Jul 6 14:30:07 2020 -0400 Remove Mocks that are not required any longer commit 494c45b02c838c5cd45344cbcc42a4f6025f361a Author: Wes Carroll Date: Mon Jul 6 14:26:56 2020 -0400 Remove tests for removed variable commit 8318229cf43bf6522470398f70de157c09b0ec9e Author: Wes Carroll Date: Mon Jul 6 14:26:36 2020 -0400 Remove Removal of Variable no longer required commit 7427ffe70709152df9bc97741d71ba37a020bd1d Author: Wes Carroll Date: Mon Jul 6 14:26:10 2020 -0400 Remove operation to set ZvmLocalInfo Variable commit 713c94461c0b4f3a72390027f0c62227072d92ff Author: Wes Carroll Date: Mon Jul 6 14:25:43 2020 -0400 Replace Script Scope LocalSite Info Variable commit 0872f1a6554d286e5c61439375904d5740836ef2 Merge: 136d1b2 a072905 Author: Wes Carroll Date: Wed Jul 1 19:11:54 2020 -0400 Merge pull request #97 from ZertoPublic/wcarroll/issue96 Fixes Set-ZertoLicense ShouldProcess issue commit a072905253596e2a3a226ac5ce8b9006c39a5f51 Author: Wes Carroll Date: Wed Jul 1 17:34:25 2020 -0400 Update ChangLog with Issue 96 updates commit 41fddf5f13fde3836df623003cb49e50cca019c9 Author: Wes Carroll Date: Wed Jul 1 17:09:38 2020 -0400 Set-ZertoLicense - Fix ShouldProcess error Fixes #96 commit 136d1b2c7695fda71eed14f4598d0951d7ec26d6 Merge: 93c55bd a25bf3a Author: Wes Carroll Date: Wed Jul 1 14:12:15 2020 -0400 Merge pull request #94 from NScuola/patch-1 Adding port information for pairing v7.5+ commit a25bf3adfe8ab407cda09286640fec150f362225 Author: NScuola <15016465+NScuola@users.noreply.github.com> Date: Wed Jul 1 14:06:30 2020 -0400 Adding port information for pairing v7.5+ Adding port information to example for pairing v7.5+. commit 93c55bdd07751556439b4c58b47fb4a983d6e2ec Merge: 6f1e582 5627992 Author: Wes Carroll Date: Tue Jun 23 13:13:40 2020 -0400 Merge pull request #93 from ZertoPublic/issue_90 Make New-ZertoVpg -RecoverySite parameter case-insensitive commit 5627992a047053eddb6ed8064fe1332d1936c585 Author: Wes Carroll Date: Tue Jun 23 12:54:03 2020 -0400 Update CHANGELOG commit 7fc7edff86f225b2aee31d12d7c36e0e57ac711f Author: Wes Carroll Date: Tue Jun 23 12:51:33 2020 -0400 Update PeerSite Lookup Method commit 6f1e582ceb58688baf5094fd6d57f5591b901a35 Merge: 6903ccc 0f1b430 Author: Wes Carroll Date: Tue Jun 23 12:40:07 2020 -0400 Merge pull request #92 from ZertoPublic/issue_89 Set New-ZertoVpg Default Parameter Set commit 0f1b4302bb51745f07c65d8d64d959072ee33045 Author: Wes Carroll Date: Mon Jun 22 17:18:55 2020 -0400 Update CHANGELOG with latest updates commit ea8d6f096da7e0bb95824e331735a341e795facd Author: Wes Carroll Date: Mon Jun 22 17:18:40 2020 -0400 Update Parameter with Proper Names commit ddae22fb9fd55c8aa93c61df00100a711bb9488a Author: Wes Carroll Date: Mon Jun 22 17:18:16 2020 -0400 Specify defaultParameterSetName commit 6903ccc99b3fb8c9f711bb5b66e1fd33a543f484 Author: Wes Carroll Date: Mon Jun 22 17:03:32 2020 -0400 Update CHANGELOG commit 7ce6369ad7063220fd5e6bea9974be59c7e82130 Author: Wes Carroll Date: Fri Jun 12 12:39:38 2020 -0400 Add tests for switches commit 2d453ef608816288d4489c572fef367fbf8a6102 Author: Wes Carroll Date: Thu Jun 11 16:34:04 2020 -0400 Put params in correct order commit 363b6e727c5e1632909a8981d0998015dd98d2e6 Author: Wes Carroll Date: Thu Jun 11 16:16:38 2020 -0400 Update Param Order Syntax in Help File commit f4c1cf630ab33728418f6680cc7eccf4d454c6a3 Author: Wes Carroll Date: Thu Jun 11 15:53:53 2020 -0400 Moved Credential to Second Position commit 348fcbd28c7d8e16be8ada599e54652bcc1c8949 Author: Wes Carroll Date: Thu Jun 11 14:19:20 2020 -0400 Update Help for AutoReconnect switch commit 3000a2b0139dd8d08cf48e07606ebba259f44404 Author: Wes Carroll Date: Mon Jun 8 12:50:29 2020 -0400 Initial auto reconnect commit 52609bf64a1a90254f0a96f08f73223f8024a8e1 Merge: c3ad8dd e021a7b Author: Wes Carroll Date: Thu Jun 18 13:26:50 2020 -0400 Merge pull request #88 from ZertoPublic/wcarroll-patch-1 Added Time Example commit e021a7bab0f745dc6af0c2e86758618e23bfb902 Author: Wes Carroll Date: Thu Jun 18 13:20:10 2020 -0400 Added Time Example Struggled to find a time example. Added one for future use. commit c3ad8dd415ae45e65981d0fec071f5251cf4f995 Merge: 932262e f81a22c Author: Wes Carroll Date: Thu Jun 11 11:35:16 2020 -0400 Merge pull request #87 from ZertoPublic/Refactor-Build Refactor build commit f81a22ca80ab094094f0dfef0682b1aaeb477e94 Author: Wes Carroll Date: Thu Jun 11 09:24:02 2020 -0400 Update Artifact Publish task to latest commit de1a85cecd63777da453350df3a86e5de7eba6e6 Author: Wes Carroll Date: Wed Jun 10 19:30:50 2020 -0400 Add ReleaseNotes.md File Creation commit d3acba3967fd0476ddcbf7e4853beae709a25ee5 Author: Wes Carroll Date: Wed Jun 10 15:54:59 2020 -0400 Remove Unused Publish Task commit 512d5bbd749bb7fcf1ff623f79c6d87f4d8b87ee Author: Wes Carroll Date: Wed Jun 10 15:52:59 2020 -0400 Update Publish Location commit 9ad9cb7f1e4624ec98b6efeded65f032a8820875 Author: Wes Carroll Date: Wed Jun 10 12:20:00 2020 -0400 Update Build Path for Artifact Utilization commit a55b0cd46734e4f220a7ec62bd0ac9abe9f27221 Author: Wes Carroll Date: Wed Jun 10 09:58:32 2020 -0400 Remove SourceFileTests publish commit aab22cf266e576168e60ccaea1ab155962061c29 Author: Wes Carroll Date: Wed Jun 10 09:53:01 2020 -0400 Add Branch to Auto-Build commit 906d35186fd6569920bc1d7dd560f953305ae995 Author: Wes Carroll Date: Wed Jun 10 09:43:32 2020 -0400 Update Required Module Versions commit c7c3428dd5cb0b48ccbe70e045d48e9cd465aa20 Author: Wes Carroll Date: Wed Jun 10 09:43:03 2020 -0400 Update release task to use full build process commit e90d2a23cc52f6ccdd0e978c5c91697aaeb2f9d7 Author: Wes Carroll Date: Wed Jun 10 09:42:41 2020 -0400 Update tests to only show failed commit 925ecaf2247a049e85f52bf514be486c0ed9de1c Author: Wes Carroll Date: Wed Jun 10 09:42:17 2020 -0400 Update default build operation commit 32403ec3e3abe29204327d9d8cf5068df5394c72 Author: Wes Carroll Date: Wed Jun 10 09:41:37 2020 -0400 Update build script with params commit 73540faeb90e1461f3e4d489b1e415f2bbf890f0 Author: Wes Carroll Date: Tue Jun 9 22:33:48 2020 -0400 Update Build Paths commit 932262e33ac4c5104466aa9c61a2f6110b277140 Merge: 7befc7d 1e84f5a Author: Wes Carroll Date: Tue Jun 9 21:27:49 2020 -0400 Merge pull request #85 from ZertoPublic/wcarroll-patch-2 Add Username Example commit 1e84f5aea0a7b28045776dad8d64483d94aee0ae Author: Wes Carroll Date: Tue Jun 9 15:21:11 2020 -0400 Add Username Example added example with username filter commit 7befc7d21e3ca3eae9a13480b6c4870b6beeb7ce Merge: 291aae9 cdad0c5 Author: Wes Carroll Date: Fri Jun 5 12:57:07 2020 -0400 Merge pull request #84 from ZertoPublic/wcarroll-patch-1 Correct example numbering issue commit cdad0c5e795a0a697a0889bb895327b48033ec38 Author: Wes Carroll Date: Fri Jun 5 09:43:48 2020 -0400 Correct example numbering issue commit 291aae9dcd1296ada46870dd69b7ab520b26a165 Merge: 6046103 f8f0d98 Author: Wes Carroll Date: Sun May 17 11:26:23 2020 -0400 Merge pull request #83 from ZertoPublic/ReleasePrep Release prep commit f8f0d980d0c9a12288634602af3e62168e097af8 Author: Wes Carroll Date: Sun May 17 11:22:12 2020 -0400 Update Unreleased to Release Number commit b72099559c45c0c833c63cbdc7b14b31e401596b Author: Wes Carroll Date: Sun May 17 11:21:56 2020 -0400 Bump Version commit 6046103da077bfe82dbffb44b5f2cb733326107b Merge: de505de cccd45b Author: Wes Carroll Date: Sun May 17 11:18:15 2020 -0400 Merge pull request #82 from ZertoPublic/Fix-ZertoStartClone Fix zerto start clone commit cccd45b7fddfc2d26798945094770c73fee40566 Author: Wes Carroll Date: Sun May 17 11:07:31 2020 -0400 Update ChangeLog commit 77b7e1c376c36726e4c8195becc499adfc667be8 Author: Wes Carroll Date: Sun May 17 11:05:15 2020 -0400 Fix Body Creation Method commit 8f735bee6249550b639c5bcb28bda7737406eb82 Author: Wes Carroll Date: Sun May 17 11:04:41 2020 -0400 Correct body creation method commit de505debf9501cedef6beddc8cf9a9d694a9f75d Merge: d4b4d1b bc570e9 Author: Wes Carroll Date: Wed May 13 10:38:31 2020 -0400 Merge pull request #81 from ZertoPublic/Invoke-ZertoMoveCommit-Fix Fix Invoke-ZertoMoveCommit commit bc570e9005ffeffdb11d8b9664c6aaf25a7bc940 Author: Wes Carroll Date: Sat May 9 20:52:55 2020 -0400 Update Changlog with MoveCommit Changes commit 804a60be774f82f72ade38b1e6bf9fb75e7b595e Author: Wes Carroll Date: Sat May 9 16:05:54 2020 -0400 Update for explicit switches commit 1e678214b152d6ce7be4df019cc268c1619cc550 Author: Wes Carroll Date: Sat May 9 16:05:32 2020 -0400 Update for explicit reverse and keep params commit ba0b12e83c84fc2008e1bb224b8f85e5fc09e869 Author: Wes Carroll Date: Sat May 9 16:04:27 2020 -0400 Add accepted values commit b33b07b524068741fedcfe876ea6db4dbd4aba00 Author: Wes Carroll Date: Sat May 9 12:19:13 2020 -0400 Set Explicit Reverse\Keep Options commit d4b4d1b4d79d6b51ec350cacfafddd18bae19284 Merge: 2887f6d fbe3f4d Author: Wes Carroll Date: Sat May 9 11:04:59 2020 -0400 Merge pull request #80 from ZertoPublic:Get-ZertoEvent-Fix Get zerto event fix commit fbe3f4d031dfbc40ac75fe643db623cb29a5a00b Author: Wes Carroll Date: Sat May 9 10:36:37 2020 -0400 Add Get-ZertoEvent Fix commit 26cfb832a4c6119770821286a1d9bc869ea3bb68 Author: Wes Carroll Date: Thu May 7 20:49:16 2020 -0400 Update CHANGELOG.md commit 865ca1dd3923797fc7b7e3c2e7d7e4e9aec37c10 Author: Wes Carroll Date: Thu May 7 20:21:39 2020 -0400 Update Logic to Convert VpgName to VpgIdentifier commit 2887f6d4500b4b12f4c12e8ee0a51bbf9812ca4b Author: Wes Carroll Date: Thu May 7 13:54:14 2020 -0400 Update README.md Fix link to updated WIKI page commit 5613b97eef7da62e63193d1c32677014ada0c86d Merge: ba2bed6 3a2e8f4 Author: Wes Carroll Date: Wed May 6 13:00:52 2020 -0400 Merge pull request #79 from ZertoPublic/PrepRelease Release Update commit 3a2e8f4ee7c0da87aaf29cb68a361c8998771d5c Author: Wes Carroll Date: Wed May 6 12:45:09 2020 -0400 Bump Version commit 380ac5c84184423e7d19bccfbbc3c0a641b93069 Author: Wes Carroll Date: Wed May 6 12:44:58 2020 -0400 Move Recent Updates to ChangeLog commit c2a0ac9fa08d52c7c61593b633965cf06ad6dee2 Author: Wes Carroll Date: Wed May 6 12:44:32 2020 -0400 Update CHANGELOG for Release commit ba2bed6b53de7f09f7c2ae208cf6e5460c5d1d9f Merge: 8b213ed 5ec0ddc Author: Wes Carroll Date: Wed May 6 09:56:01 2020 -0400 Merge pull request #78 from ZertoPublic/Update-Function-Tests Update function tests commit 5ec0ddce62ca58036ce8e1cb19abbe6bd5bf0a81 Author: Wes Carroll Date: Wed May 6 08:24:28 2020 -0400 Add general Changes to Changelog commit 83f00e00ee382fc8723a44f53c70d97fda88dc84 Author: Wes Carroll Date: Wed May 6 08:17:26 2020 -0400 Update the Version Pattern commit 63a1ab928ecd2554d5796f42230af272a9062a39 Author: Wes Carroll Date: Tue May 5 22:13:54 2020 -0400 Update builtfiletests to ensure module is built commit e6ead11891e522f233b6683732edbfdc4dfe197f Author: Wes Carroll Date: Tue May 5 21:59:14 2020 -0400 Update mandatory parameter declaration commit aecd4fd1d5adaa20b93395d2666b5a419d406c97 Author: Wes Carroll Date: Tue May 5 21:25:54 2020 -0400 Updated CHANGELOG with formatting information commit 8dcee4068ada958754ad1fc3975870a30cfa3a3f Author: Wes Carroll Date: Tue May 5 16:30:49 2020 -0400 Update PSSA Rules for New PSSA Version commit b0d68ea22406982a4da9f1386eb87eddbd244aa5 Author: Wes Carroll Date: Tue May 5 16:29:56 2020 -0400 Updete to use process block for pipeline commit 22b0da87b962cddeb85a3bcc864c5b48052a2fab Author: Wes Carroll Date: Tue May 5 14:35:29 2020 -0400 Update to latest versions of modules commit fc3c08637bb002e41f6733e69e07075620397065 Author: Wes Carroll Date: Tue May 5 14:32:13 2020 -0400 Module Release Notes point to GitHub commit 48940842925ead9b0ab7d4a05344e875a9f0b6f8 Author: Wes Carroll Date: Tue May 5 14:27:27 2020 -0400 Remove RELEASENOTES for CHANGELOG commit 781368398cd9056baebb12e5ea43d45c523e8a5c Author: Wes Carroll Date: Tue May 5 14:26:41 2020 -0400 Update release notes to point to CHANGELOG commit 4271afd5b4f55f1854d95c6c6fb41ca7c644e489 Author: Wes Carroll Date: Tue May 5 14:11:49 2020 -0400 Move historical Release Notes to ChangeLog commit 6c2b029014de54b9baa6cfadd459e10cdeb30b45 Author: Wes Carroll Date: Tue May 5 13:47:19 2020 -0400 Update Parameter Name to work with filter commit e47458b2df402114f610b1a01ae966e25cd57aa4 Author: Wes Carroll Date: Thu Apr 30 11:53:55 2020 -0400 Update ReleaseNotes to maintain history commit d38f20682497e02c8b1c8fd556fe9ed541a6c57e Author: Wes Carroll Date: Thu Apr 30 11:11:29 2020 -0400 Update ZVM Headers commit ed6024fe63c0a18c86163dfd67e0b34baa427a5e Author: Wes Carroll Date: Tue Apr 14 16:24:45 2020 -0400 Add Tests for Password Update # Conflicts: # Tests/Public/Edit-ZertoVra.Tests.ps1 commit 8b213ede2587673107a3284c2d93f446edc24970 Merge: 8578c77 6620246 Author: Wes Carroll Date: Mon Apr 20 17:00:00 2020 -0400 Merge pull request #77 from ZertoPublic/Pester5Prep Pester 5 prep commit 6620246e4cd13488ebbc18a71874734ec1b9f4a4 Author: Wes Carroll Date: Mon Apr 20 16:35:02 2020 -0400 Update Method to Grab Path https://jakubjares.com/2020/04/11/pester5-importing-ps-files/ commit 71610ce9fe37b01820a4025905c2a5c093c50eff Author: Wes Carroll Date: Tue Apr 14 16:03:15 2020 -0400 Pin Pester v4 commit fb45693fb19e8ac2851bdfa7a7aa08fb94201a8d Author: Wes Carroll Date: Sat Apr 11 22:35:23 2020 -0400 Pester 5 Prep commit 8578c775ddbbe3d5698b51ace3d87cb9d9377fb1 Merge: 9fafe4b b186c56 Author: Wes Carroll Date: Mon Apr 20 16:19:54 2020 -0400 Merge pull request #76 from ZertoPublic/Refactor-Copy-ZertoVpg Refactor Copy-ZertoVpg and Add Tests commit b186c561e62d0d38c44d29d79523fc5b38323b80 Author: Wes Carroll Date: Mon Apr 20 16:14:41 2020 -0400 Start of Next Releasenotes commit ae6a80b48d115c584f1cb4357fb1a9c8160b1c22 Merge: c1b7c49 9fafe4b Author: Wes Carroll Date: Mon Apr 20 15:50:13 2020 -0400 Merge branch 'master' into Refactor-Copy-ZertoVpg commit 9fafe4b58be64eeb1eb1ce88cf0f151bbb2a4093 Author: Wes Carroll Date: Fri Apr 17 08:50:27 2020 -0400 Make PowerShell Gallery Badge Clickable commit c1b7c490ff902169218902baf03cd705375dba11 Author: Wes Carroll Date: Tue Apr 14 09:26:56 2020 -0400 Create Function Tests commit 589a3b7d6e194632089c294ca8865b82c4154615 Author: Wes Carroll Date: Tue Apr 14 09:25:16 2020 -0400 Create Mock Data for Tests commit 9913c96d658cfaf7b0cfc41259588804f51775f3 Author: Wes Carroll Date: Tue Apr 14 09:26:22 2020 -0400 Refactor Function commit fe4d8cf4dd7160adcc600adba949afe55f7ce036 Merge: e374442 e35939e Author: Wes Carroll Date: Fri Apr 10 08:14:00 2020 -0400 Merge pull request #75 from ZertoPublic/ReleasePrep April Release commit e35939e592aca32a61c39782af3e4f1d27a57c09 Author: Wes Carroll Date: Thu Apr 9 14:37:38 2020 -0400 Bump Version commit c422e269035db90b3b7ac43d6ed465fa0f3a9cc6 Author: Wes Carroll Date: Thu Apr 9 14:37:27 2020 -0400 Update Readme for release commit e37444249e874cfa9db4bc0b16439c2909260037 Merge: 85e60ad 616cdcf Author: Wes Carroll Date: Thu Apr 9 13:27:35 2020 -0400 Merge pull request #74 from ZertoPublic/VirtulizationSiteRepos Add functionality for ZVM 8.0 commit 616cdcf7a27ce2eac0db7db5c063ead1656390e1 Author: Wes Carroll Date: Thu Apr 9 13:22:57 2020 -0400 Update Tests for WindowPS commit e7658fcfec8cf1151060a4df87af5044e49d7460 Author: Wes Carroll Date: Thu Apr 9 13:22:42 2020 -0400 Update the version of Pester to latest version commit a306391a14cbec5aa62a6d278b66eba26eb9a8a0 Author: Wes Carroll Date: Thu Apr 9 12:55:41 2020 -0400 Fix Filename Case commit 83e95516925fb37a96f82b01a3dcb42d62e18a44 Author: Wes Carroll Date: Thu Apr 9 12:48:33 2020 -0400 Add tests for function commit 7fbc550390ce0f8a58b26246d1576692963ac1d6 Author: Wes Carroll Date: Thu Apr 9 12:48:04 2020 -0400 Add Mocks for Tests commit e3cba682c7b1459adea405db2a78517e16c27629 Author: Wes Carroll Date: Thu Apr 9 10:37:36 2020 -0400 DRY Refactor commit 96b3e65be22080248a8a0fa16bb5f020a97bcb0c Author: Wes Carroll Date: Wed Apr 8 15:26:10 2020 -0400 Update RELEASENOTES.md commit d15111a883f0b8373fcb9b14f5b54a02a561d36f Author: Wes Carroll Date: Wed Apr 8 15:19:46 2020 -0400 Add new LTR API Endpoint Added new LTR endpoint and help messages to indicate that it will only work with Version 8.0 and above. Also updated help message for backup settings indicating that backup settings only work with 7.5 and below. commit 90434b56a29612a8fbf64129d231d277bf6fbb57 Author: Wes Carroll Date: Tue Apr 7 17:35:55 2020 -0400 Updated for new Repositories endpoint commit 85e60adac1508a57078c53faacbb06dada8301f0 Merge: d55bc3e 0d6bc39 Author: Wes Carroll Date: Tue Apr 7 10:44:00 2020 -0400 Merge pull request #73 from ZertoPublic/UpdateServiceAccountPassword Create function to Update service account password commit 0d6bc39c86d85a08033e9a41913fe413d3fe6a0d Author: Wes Carroll Date: Tue Apr 7 10:30:42 2020 -0400 Add an additional example commit ad2073f404011081cdbb53ff6c1be736a0e42ed8 Author: Wes Carroll Date: Tue Apr 7 10:27:22 2020 -0400 Fixed submitted body formatting commit e12bf9d85edfa5aacce37aa7de448b84dcb89f9f Author: Wes Carroll Date: Tue Apr 7 10:18:37 2020 -0400 Fix script level variable commit a5f3ad4de0b7462720e517c61956e04622971078 Author: Wes Carroll Date: Tue Apr 7 10:05:34 2020 -0400 Update RELEASENOTES.md commit 77fb3c8f678136de5b01aa5799bd1f953c89fed9 Author: Wes Carroll Date: Tue Apr 7 10:05:31 2020 -0400 Fix helpmessage typo commit b2e5fe7b5cfefdf3d4668b0f10c40d8e9a96621f Author: Wes Carroll Date: Tue Apr 7 10:04:55 2020 -0400 Update Set-ZertoUserCredential.md commit f34f21bb85c4395d6d97e47105e008134c8cfa78 Author: Wes Carroll Date: Tue Apr 7 07:49:13 2020 -0400 Create Set-ZertoUserCredential.md commit 536a62f792cdafd64a85329de543cf252672914b Author: Wes Carroll Date: Mon Apr 6 17:15:57 2020 -0400 Create Set-ZertoUserCredential.Tests.ps1 commit df83277c066cb7293b0a5de58401ce008fb4a5da Author: Wes Carroll Date: Mon Apr 6 17:15:52 2020 -0400 Create Set-ZertoUserCredential.ps1 commit d55bc3e4b30369617893bd378bdd9ca3b6cb6d46 Merge: 64fa03e 7488e79 Author: Wes Carroll Date: Sat Apr 4 10:42:56 2020 -0400 Merge branch 'UpdateVraWithPassword' commit 7488e7999ff5c8f0a1860c458aa02a23d556d11e Author: Wes Carroll Date: Sat Apr 4 10:36:51 2020 -0400 Updated Release notes with current changes commit dcba2b04a94a07fd061a0adbb185014cd69f6931 Author: Wes Carroll Date: Sat Apr 4 10:30:46 2020 -0400 Added Edit Password Information commit bd94bfe5db183265366b4a9f6211f4773fe39f94 Author: Wes Carroll Date: Sat Apr 4 10:26:56 2020 -0400 Update Help Files commit fb722661a79f1b59514e43c08d229ad12a12e246 Author: Wes Carroll Date: Fri Apr 3 16:51:09 2020 -0400 Update Edit-ZertoVra.Tests.ps1 commit 61219405639eb66d916c45634ca7c5199ee04160 Author: Wes Carroll Date: Fri Apr 3 10:35:44 2020 -0400 Added ability to updated Host Password commit 64fa03e4ea6d626444a0a8df7481a716256878da Merge: c94f04d 8685444 Author: Wes Carroll Date: Thu Apr 2 19:57:38 2020 -0400 Merge pull request #71 from ZertoPublic/ZA-Planner Updates for Zerto Analytics commit 86854442ef188829775f0443323407ea8785f1bf Author: Wes Carroll Date: Thu Apr 2 17:56:57 2020 -0400 Update Online Link to Help commit bc46a512cdac91c8957cbfe2f6c20c5d598073d7 Author: Wes Carroll Date: Thu Apr 2 17:55:04 2020 -0400 Update RELEASENOTES.md commit 0a84246d8ebf421e7e0287f0906e83f7697b321e Author: Wes Carroll Date: Thu Apr 2 17:44:16 2020 -0400 Add parameter validation commit f299aecb9b6e548944be74a639d822c5d54e276f Author: Wes Carroll Date: Thu Apr 2 17:44:00 2020 -0400 Add parameter validation commit 646476e74ecb8d9debb052c38029ea2d03a9b75f Author: Wes Carroll Date: Thu Apr 2 17:43:50 2020 -0400 Remove unused parameter commit 285a82f2805f21bbabd88f8c6abc48b7ffb46b8f Author: Wes Carroll Date: Thu Apr 2 17:43:39 2020 -0400 Fix Parameter Test commit fbe9fb2af8ba246008cfcfe5a487b691d6e6ad4d Author: Wes Carroll Date: Thu Apr 2 17:43:28 2020 -0400 Fix Parameter Test commit 1af70b8c80710ae83fa2edbf92e17d343bf1edf6 Author: Wes Carroll Date: Thu Apr 2 17:38:35 2020 -0400 Create Tests commit 0ef71c25bbecae300e1d8dcddcc23cfba83bb0ba Author: Wes Carroll Date: Thu Apr 2 17:16:14 2020 -0400 Update Get-ZAPlannerZcasReport.md commit 78e1cdb9810a7a12d2188b29904c984a948cd742 Author: Wes Carroll Date: Thu Apr 2 17:16:11 2020 -0400 Update Get-ZAPlannerWanReport.md commit 1a66d4e64bc08b4c8874d18f958717ea6efffad7 Author: Wes Carroll Date: Thu Apr 2 17:09:25 2020 -0400 Update Get-ZAPlannerStatsReport.md commit 2fef1dbc428faf20441f43d674a48d0b79511dd7 Author: Wes Carroll Date: Thu Apr 2 16:46:59 2020 -0400 Create Get-ZAProtectedVmReport.md commit b00ededc7fcf538845f874774af9a1b7fda4943f Author: Wes Carroll Date: Thu Apr 2 16:44:08 2020 -0400 Create Get-ZAProtectedVm.md commit 8e5ced9b871ab968438e096f454f1f94320e5f8c Author: Wes Carroll Date: Thu Apr 2 15:12:52 2020 -0400 Create Get-ZAProtectedVmReport.ps1 commit 69fb384c89577aaff09003e25c65cfb9fac3bd95 Author: Wes Carroll Date: Thu Apr 2 15:12:43 2020 -0400 Create Get-ZAProtectedVm.ps1 commit a8b9ec3a009774c6c05cd71ee42121822eda58be Author: Wes Carroll Date: Thu Apr 2 15:12:04 2020 -0400 Update Help File Formatting commit 355be7c1e5fbf44179936f42b86f6974c840c743 Merge: 3e980dc c94f04d Author: Wes Carroll Date: Thu Apr 2 12:30:58 2020 -0400 Merge branch 'master' into ZA-Planner commit c94f04de77d8ad98810dec2fe97a7572701bd7bd Merge: d39777c f4807f9 Author: Wes Carroll Date: Thu Apr 2 12:29:36 2020 -0400 Merge pull request #69 from ZertoPublic/MultiClusterSingleDatastore Updates to Install-ZertoVra commit f4807f94fb4510bf3f00f8a5cdcac2f6ae7356ad Merge: 83879a5 d39777c Author: Wes Carroll Date: Thu Apr 2 12:25:25 2020 -0400 Merge branch 'master' into MultiClusterSingleDatastore commit d39777cbb0e8082d89a2fd4ec65b9c6e8c4aa628 Merge: 71352ca 8b43856 Author: Wes Carroll Date: Thu Apr 2 12:22:14 2020 -0400 Merge pull request #70 from ZertoPublic/AzurePipelinesUpdates Update build agents. commit 8b43856558337e564eb24adfedac233c0c0ca2ab Author: Wes Carroll Date: Thu Apr 2 12:17:55 2020 -0400 Update build agents. commit 83879a51e7f99f0f6aea2bdbe7309672505b9758 Author: Wes Carroll Date: Thu Apr 2 11:54:48 2020 -0400 Update RELEASENOTES.md commit 2d1fb8e4db676c4addac5f3d80ab8b6f13782db6 Author: Wes Carroll Date: Thu Apr 2 10:51:05 2020 -0400 Update Install-ZertoVra.md commit e774cd861d7172e8bb4b2f5d4623814cee415f9e Author: Wes Carroll Date: Thu Apr 2 10:48:19 2020 -0400 Update Copy-ZertoVpg.md commit a660aa29b3ed11197532c633d6659f973437f3f3 Author: Wes Carroll Date: Thu Apr 2 10:48:02 2020 -0400 Update Common Parameters formatting commit 82458712f03eb992f68a9b7766f0d2fd33280961 Author: Wes Carroll Date: Thu Apr 2 10:46:40 2020 -0400 Update tests for new functionality commit bae9eb9b99df1f7da306a0a206ed845c340a4529 Author: Wes Carroll Date: Thu Apr 2 10:27:20 2020 -0400 Update function to enable password installation commit 2ea7092b910a469bfce1c2a8a9c994f6014b821d Author: Wes Carroll Date: Wed Apr 1 17:14:21 2020 -0400 Update logic to only allow install to attached devices commit de08f0eece205cc2e0dd093817882aa0b760b30d Author: Wes Carroll Date: Thu Mar 19 17:08:08 2020 -0400 Ensure the right DSId is mapped to the target host. commit 3e980dc195107f8dc5105b174f8d3e101ab09333 Author: Wes Carroll Date: Thu Mar 19 16:25:28 2020 -0400 Add Online Help URI commit eccc5f27f335234a444ed8ca3bb8bf76f48744a9 Author: Wes Carroll Date: Thu Mar 19 09:21:05 2020 -0400 Update Get-ZAPlannerNetworkPerformanceReport.md commit e516a24e38ebaebe1a9b8fb05a2aaccf499ea8cd Author: Wes Carroll Date: Thu Mar 19 09:19:48 2020 -0400 Update Get-ZAPlannerJournalSizeReport.md commit 07f92583f80938e2426ba4b745232fa0c2132372 Author: Wes Carroll Date: Wed Mar 18 13:57:12 2020 -0400 Update Single Site URL commit c2f554dca13940f051ff2a045c00a28f758d3282 Author: Wes Carroll Date: Wed Mar 18 13:54:58 2020 -0400 Update Get-ZAPlannerSite.md commit 8bd865d83d9e59aa9a6117983406bd0d54f58bda Author: Wes Carroll Date: Sun Mar 8 22:45:51 2020 -0400 Create Template Help Files commit 02e50d9cd63fa96166ba57411274159c84377a7c Author: Wes Carroll Date: Sun Mar 8 17:33:36 2020 -0400 Create Get-ZAPlannerZcasReport.ps1 commit 7fc0a5f5793a8267e0979e403a19429fbe915a16 Author: Wes Carroll Date: Sun Mar 8 17:33:31 2020 -0400 Create Get-ZAPlannerWanReport.ps1 commit ce5a64c6834f3bed0b2bdf1371ceb23b98bd88ef Author: Wes Carroll Date: Sun Mar 8 17:33:27 2020 -0400 Create Get-ZAPlannerNetworkPerformanceReport.ps1 commit 1317a6c039a36fc12451e29231aa535ceb767a68 Author: Wes Carroll Date: Sun Mar 8 17:33:24 2020 -0400 Create Get-ZAPlannerJournalSizeReport.ps1 commit 169e628c7b59c9e0f8fc3eb3aadb97e03a72fb30 Author: Wes Carroll Date: Sun Mar 8 14:57:19 2020 -0400 Remove Debugging Output commit d35d9d7cf40f5b2bdc79bb87c44958191bbca5d8 Author: Wes Carroll Date: Sun Mar 8 14:40:22 2020 -0400 Create Get-ZAPlannerStatsReport.ps1 commit a891a4914df420d2d98397522917eace1cb2d5f3 Author: Wes Carroll Date: Sun Mar 8 14:39:34 2020 -0400 Create Get-ZAPlannerSite.ps1 commit 71352cae7b155b59039960f4fb891d17e5b949da Merge: fad3ca0 b0edd90 Author: Wes Carroll Date: Fri Mar 6 17:22:53 2020 -0500 Merge pull request #68 from ZertoPublic/IZRR-to-public Move RestRequest functions into Public commit b0edd9026fdd331394ea9ac2cac38958e41facd7 Author: Wes Carroll Date: Fri Mar 6 14:08:12 2020 -0500 Update RELEASENOTES.md commit 7cde687d709901fffe5fb9dfec9f593d52a9716a Author: Wes Carroll Date: Fri Mar 6 13:42:58 2020 -0500 Create Documentation for Newly Public Functions commit 569d9e264c0693c2598ef56a3ecd3fa814bb5eff Author: Wes Carroll Date: Fri Mar 6 13:42:39 2020 -0500 Update ZertoRestRequest and associated Tests commit 40331c26f93b0cc965279cb0847456dbb73c1984 Author: Wes Carroll Date: Fri Mar 6 13:42:20 2020 -0500 Update ZARestRequest and associated tests. commit 526093afc64cc2455fcecfe0b2750314b1654918 Author: Wes Carroll Date: Fri Mar 6 13:31:59 2020 -0500 Fix the Tests extension commit dc4dd1ad050d9fa0b9637826df53a74b04062ec6 Author: Wes Carroll Date: Fri Mar 6 10:40:21 2020 -0500 Move IZRR function to public commit 779ee1415e5095ab9b4450489cef7ec5522caf23 Author: Wes Carroll Date: Fri Mar 6 10:38:41 2020 -0500 Move IZRR to public commit 13592df6aa4f4aaaad7fb8d7602ecf84de1eadd5 Author: Wes Carroll Date: Fri Mar 6 10:33:12 2020 -0500 Move ZARestRequest to Public Function commit fad3ca0e2746a02c00912649d4e3ee5e2bbe216f Author: Wes Carroll Date: Fri Mar 6 10:01:17 2020 -0500 Update RELEASENOTES.md commit 52782aa1e5ecbdf6f251663882c224e4570b92d2 Merge: cc9e53a bc02e79 Author: Wes Carroll Date: Fri Mar 6 09:11:10 2020 -0500 Merge pull request #67 from ZertoPublic/Refactor-GetVpg Refactor Get-ZertoVpg commit bc02e796d652bc892dfa514a140cd15b90a4e3a6 Author: Wes Carroll Date: Thu Mar 5 21:43:52 2020 -0500 Refactor for DRY commit 4c32bbe057e488b73f99a3ead4695a9e0d086938 Author: Wes Carroll Date: Thu Mar 5 21:43:32 2020 -0500 Update to PwSh Version 7 commit cc9e53ac4492464a670ca3c6f6c5bc83139ba7ca Merge: ecab250 37165e1 Author: Wes Carroll Date: Mon Mar 2 10:30:12 2020 -0500 Merge branch 'fix-typos' commit 37165e18a79d86806417d38a878ec155e6551180 Author: Wes Carroll Date: Mon Mar 2 10:00:45 2020 -0500 Typo Correction Update commit 772848beeff1af9e68d0dea1e0cf105145f83c22 Author: Wes Carroll Date: Mon Mar 2 09:53:55 2020 -0500 Updated help file to reflect typo correction commit 18185612bb87055c39699d45a034c9601858a216 Author: Wes Carroll Date: Mon Mar 2 09:51:23 2020 -0500 Fixed recovery switch typo commit ecab2500c7dbc631d5c43567c2c897f7ee8c278d Merge: 1e80bb0 fde7f67 Author: Wes Carroll Date: Mon Mar 2 09:46:34 2020 -0500 Merge pull request #65 from ZertoPublic/checkpoint-refactor Checkpoint refactor commit fde7f67e45f2c34765e3210e41605f790bb4e29e Author: Wes Carroll Date: Mon Mar 2 09:41:09 2020 -0500 Update RELEASENOTES.md commit e19f9b34f549a9b97ab035502ce84ee21b8f03a0 Author: Wes Carroll Date: Fri Feb 28 08:15:53 2020 -0500 Update function to allow pipeline operations commit a36a7cb37ae30f22b84f2979a5e80aac6b18534b Author: Wes Carroll Date: Fri Feb 28 08:15:15 2020 -0500 Cleanup documentation commit 1e80bb06fbd04ab40e71ea1e8e8ef1dd8431e1e6 Merge: 02f1c89 4c98b75 Author: Wes Carroll Date: Sun Dec 22 11:01:27 2019 -0500 Merge pull request #63 from ZertoPublic/ExportNicUpdate Update Export and Import VpgNicSetting functions commit 4c98b7513438a958ffa26c83dcd7d42aaf048da7 Author: Wes Carroll Date: Sun Dec 22 10:48:07 2019 -0500 Update RELEASENOTES.md commit a7efc7c717cda99f73d60d68056b24ea0c818f95 Merge: 8015531 02f1c89 Author: Wes Carroll Date: Sun Dec 22 10:37:44 2019 -0500 Merge branch 'master' into ExportNicUpdate commit 02f1c89d866807dc9a9306dd6f08cb80163aec5d Merge: 579ba7a 5b9243a Author: Wes Carroll Date: Sun Dec 22 10:35:35 2019 -0500 Merge pull request #62 from ZertoPublic/RecoveryReport Remove -VpgIdentifier Parameter from Get-ZertoRecoveryReport function commit 5b9243a02f5972b6f080bf278b0a2c02e8fc09bc Author: Wes Carroll Date: Sun Dec 22 10:16:27 2019 -0500 Updated releasenotes with changes commit 1962dda15c7ac1bdc5f0b3d60a17d1a2b0d2c521 Author: Wes Carroll Date: Sun Dec 22 10:07:17 2019 -0500 Remove vpgIdentifier Parameter vpgIdentifier Parameter as added as a parameter by mistake. The API does not accecpt this as a filter. commit 801553178e72d326b1905e4097d71779bd57617b Author: Wes Carroll Date: Fri Dec 20 22:56:20 2019 -0500 Update Online Help Link commit 6c92dff447a0c36c49197a587c68235561eebe94 Author: Wes Carroll Date: Fri Dec 20 22:56:04 2019 -0500 Update Description with new logic commit 003396998c41ae3ac95bcd24de690ad2c333b12b Author: Wes Carroll Date: Fri Dec 20 21:09:12 2019 -0500 Eliminate Blank Output commit 05783a1f37a531d0f55367c5c8a53f847f5bdd0c Author: Wes Carroll Date: Thu Dec 19 18:49:13 2019 -0500 Update Import Logic commit 270470f858cd7806199d3d22388d6975e63ab45a Author: Wes Carroll Date: Wed Dec 18 13:06:11 2019 -0500 Update Nic Object Logic commit 579ba7a0630e9aa951cee097cdb4e08b6aa961cd Merge: abadc86 2cb3516 Author: Wes Carroll Date: Sun Dec 1 17:15:24 2019 -0500 Merge pull request #59 from ZertoPublic/PrepRelease Prep release commit 2cb35165a949b0035dcba71b1fc18d3d71a7e013 Author: Wes Carroll Date: Sun Dec 1 17:09:57 2019 -0500 Update README commit 82cf4cb732220363c73a2c9643445b36d2f437f7 Author: Wes Carroll Date: Sun Dec 1 17:05:53 2019 -0500 Bump Version for Release commit 9d21eb64098951bde5803985e0fc8c31911da81d Author: Wes Carroll Date: Sun Dec 1 17:05:40 2019 -0500 Format Release Notes commit abadc86ae8bb61b752933ca55aa866621c2882b7 Merge: 7cad7ea f094263 Author: Wes Carroll Date: Sun Dec 1 17:01:53 2019 -0500 Merge pull request #58 from ZertoPublic/FoT-Fix Fixes Failover Test function commit f094263882183290f761b795eda9f585ac5b1b22 Author: Wes Carroll Date: Thu Nov 28 10:55:59 2019 -0500 Update RELEASENOTES.md commit c47614727ab27760fc0d8204bc0a3125f134b28c Author: Wes Carroll Date: Thu Nov 28 10:41:26 2019 -0500 Fix Verbose Typo commit 7cad7eaf75536ce41aa9b9ed4bbc151e8fe4b1ad Merge: 5b8a89e d6862f7 Author: Wes Carroll Date: Fri Nov 8 08:32:13 2019 -0500 Merge pull request #56 from ZertoPublic/CopyVpgBugFix Fix Bug when Adding Additional VMs commit d6862f75d1bd97b02cdc6638927d75cce0d560ad Author: Wes Carroll Date: Thu Nov 7 22:35:40 2019 -0500 Fix Bug when Adding Additional VMs commit 5b8a89e1a3536076c481e46c427f4cf15a633642 Merge: 5c76c4c d6562de Author: Wes Carroll Date: Thu Nov 7 21:45:27 2019 -0500 Merge pull request #55 from ZertoPublic/CloneVPG Implement Clone VPG Function commit d6562de9bffd244802c1bf6f2164d875b2d13e54 Author: Wes Carroll Date: Thu Nov 7 21:37:03 2019 -0500 Update for Copy-ZertoVpg commit cdae2039935bc5b21edac07f9378fcf1bd56c1f5 Author: Wes Carroll Date: Thu Nov 7 17:44:06 2019 -0500 Fix Documentation Formatting commit 213b6029e4bc31b0404bc739cd21284dbad1772c Author: Wes Carroll Date: Thu Nov 7 17:43:40 2019 -0500 Create Documentation commit 11ab03be0ae568e60ea092566ae0a14d49b0ece1 Author: Wes Carroll Date: Thu Nov 7 17:43:29 2019 -0500 Create Tests commit 5f978d7b1a686864779fb4fa03464817a40ee1c8 Author: Wes Carroll Date: Thu Nov 7 17:43:18 2019 -0500 Fix AddVM Logic commit 5c76c4c58c62c6be9a10347f5f51dc1f97433e77 Merge: 8a1593c 8b3a3b3 Author: Wes Carroll Date: Mon Nov 4 16:20:49 2019 -0500 Merge pull request #53 from ZertoPublic/wcarroll-patch-1 Update Connect-ZertoServer.md commit 8b3a3b3b0b373094c92b4895c99aed6e2f915617 Author: Wes Carroll Date: Mon Nov 4 16:20:31 2019 -0500 Update Connect-ZertoServer.md commit 63d56cf8628535d00ca1da7c8ab51dd58d2969a9 Merge: 10785df 5984bc9 Author: Wes Carroll Date: Fri Oct 25 14:10:09 2019 -0400 Merge branch 'CloneVPG' of https://github.com/wcarroll/ZertoApiWrapper into CloneVPG commit 10785df8a99ef7cea480d156452949f4e28f92c6 Author: Wes Carroll Date: Sat Oct 12 22:26:13 2019 -0400 Create Copy-ZertoVpg Function commit 8a1593cebae45984bc63ce38fc7e58bf58439fef Merge: 528bc66 1ca3d67 Author: Wes Carroll Date: Fri Oct 25 14:03:26 2019 -0400 Merge pull request #52 from ZertoPublic/EvacuateHost Implement Evacuate VRA Function commit 1ca3d6704b6dcffff3cef0ff3cff0f3178e975b9 Author: Wes Carroll Date: Fri Oct 25 13:49:59 2019 -0400 Update Release Notes for Evacuate Function commit b4a7df970c1fa0ad01bca00fc270ef581ab590a3 Author: Wes Carroll Date: Thu Oct 24 13:51:26 2019 -0400 Correct VraIdentifier Property commit 3d8acf03f68ac7231373d3d7012b405591438249 Author: Wes Carroll Date: Thu Oct 24 13:50:52 2019 -0400 Update Tests to include set counts commit 07de073bf137b1650ddc9d46b2497a7d4cf2af6d Author: Wes Carroll Date: Thu Oct 24 07:25:38 2019 -0400 Create Invoke-ZertoEvacuateVra.Tests.ps1 commit 7641d283071196cd6d3d936d2ef704f53204ef4b Author: Wes Carroll Date: Wed Oct 23 10:00:42 2019 -0400 Add parameter validation commit 30422d0421973fdb81fac166b7cd9c0f6c275614 Author: Wes Carroll Date: Wed Oct 23 09:52:09 2019 -0400 Create Invoke-ZertoEvacuateVra.md commit 4a0885f731cdaacedc32d5eeda8ad0b16f33c701 Author: Wes Carroll Date: Tue Oct 22 13:35:49 2019 -0400 Fix Help Message Typo commit 28d66806a552c051e4659d108137787b68147201 Author: Wes Carroll Date: Tue Oct 22 13:31:10 2019 -0400 Add ExternalHelp Def commit 42b923cef5f9852929269cfaa607318886bd6b79 Author: Wes Carroll Date: Tue Oct 22 13:26:10 2019 -0400 Create EvacuateVra Function commit 5984bc93c9a8f7cfa5030361cb3e27485ebe04ec Author: Wes Carroll Date: Sat Oct 12 22:26:13 2019 -0400 Create Copy-ZertoVpg Function commit 528bc66bcdfc0c9b910c83e76fb1e613c0db54ef Merge: 9d34086 e706470 Author: Wes Carroll Date: Tue Oct 8 12:45:15 2019 -0400 Merge pull request #49 from ZertoPublic/New-Token Add Function to Obtain a Pairing Token commit e706470395691432315419ffbc6d35ae9d2e5c3d Author: Wes Carroll Date: Tue Oct 8 12:37:11 2019 -0400 Add `New-ZertoPairingToken` to Release notes. commit 29a79bbb923b7ebd4906dba15ed57614923f9d00 Author: Wes Carroll Date: Tue Oct 8 12:31:34 2019 -0400 Correct extension case. commit f907acd14a634946a5da5f4efe7782eb54b59046 Author: Wes Carroll Date: Mon Oct 7 11:23:24 2019 -0400 Create New-ZertoPairingToken.md commit 90a17045af201a777eb3ec599436d25cd218873e Author: Wes Carroll Date: Mon Oct 7 11:23:19 2019 -0400 Create PairingToken.Json commit e1ba8412ff1d5c5f767a0d242f032a1e1461686a Author: Wes Carroll Date: Mon Oct 7 11:23:13 2019 -0400 Create New-ZertoPairingToken.Tests.ps1 commit 0a90d51735dbb1c02d4d9f397c8d4cdc5ce5a80a Author: Wes Carroll Date: Mon Oct 7 11:23:10 2019 -0400 Create New-ZertoPairingToken.ps1 commit 9d34086e40dfa9772aaeb685d92c8d80ccabe7b3 Merge: 6cc2e8d 842c7ce Author: Wes Carroll Date: Fri Oct 4 17:01:37 2019 -0400 Merge pull request #48 from ZertoPublic/75Update Update to add token parameter to Add-ZertoPeerSite commit 842c7ceeec0a1d74ac1b55250dacc8d964646f78 Author: Wes Carroll Date: Thu Oct 3 16:54:56 2019 -0400 Added release notes for this update. commit d78fc28b1ce219ab8a5cf6a40519b9333f8d970a Author: Wes Carroll Date: Thu Oct 3 14:33:17 2019 -0400 Add ShouldProcess support to help file. commit 28fb42d56a493428a03fc3a356433e27c84e1f02 Author: Wes Carroll Date: Thu Oct 3 14:33:01 2019 -0400 Update documentation for token parameter and example. commit 0657607f3a7dd0de4ade430743cb1bbb6a97955d Author: Wes Carroll Date: Thu Oct 3 14:32:36 2019 -0400 Update Tests to New format and add token parameter tests commit 32f6a6eebc21e134e16e8fa8fb271f7cc4a70930 Author: Wes Carroll Date: Thu Oct 3 14:32:05 2019 -0400 Update function to use new token parameter commit 6cc2e8d61d1298fee508c1e128a38253809c0bff Author: Wes Carroll Date: Wed Sep 4 15:45:17 2019 -0400 Correct Example Number Typo commit b9598e7e0bc3968e57fa70a71a917873f922b1d5 Author: Wes Carroll Date: Thu Aug 1 14:11:59 2019 -0400 Add Aug Release in recent updates. commit a9ea273d557c217d471f5007756e4da32a7dff13 Author: Wes Carroll Date: Thu Aug 1 11:51:04 2019 -0400 Bump Version for Release commit f5c81a0766e3aa5d6f5d4f87398e44dc5d2c37d9 Author: Wes Carroll Date: Thu Aug 1 11:50:46 2019 -0400 Update RELEASENOTES.md commit 3a8e742aad141828bd4d4bfa0fa2e49bbf883bea Merge: a4e3961 7b07fb0 Author: Wes Carroll Date: Tue Jul 30 10:22:36 2019 -0400 Merge pull request #44 from ZertoPublic/NewVpgBugFix Update method to add VMs to Object commit 7b07fb0fd7c638aedb809f58895aff4b53036fd9 Author: Wes Carroll Date: Mon Jul 29 08:50:25 2019 -0400 Update method to add VMs to Object commit a4e3961bd71b76f83cc1d512d56c78fc6ab21b48 Merge: 46951b7 551eac5 Author: Wes Carroll Date: Fri Jul 26 11:13:41 2019 -0400 Merge pull request #42 from ZertoPublic/UpdateTests Update Testing Methods commit 551eac5d5a966bcae8b95f61781f5ceafb4bb6be Author: Wes Carroll Date: Fri Jul 26 11:06:07 2019 -0400 Update release notes for testing changes commit 916fbb6c4c90040c67feeb2e97d2b949963a4171 Author: Wes Carroll Date: Tue Jul 23 13:13:38 2019 -0400 Add Parameter Validation Tests commit 5c2e16d5c6224270dd35fbca7fe1799f130661a4 Author: Wes Carroll Date: Tue Jul 23 13:13:24 2019 -0400 Add Parameter Validation commit 8b0def7c50f8020f395e64cd815bf1741a9f17d2 Author: Wes Carroll Date: Tue Jul 23 12:59:23 2019 -0400 Update Parameter Tests commit 73884ef022c546af93ba5e3f5f084346c2c650c8 Author: Wes Carroll Date: Tue Jul 23 12:57:01 2019 -0400 Update Parameter Tests commit fd1619351edc8eca8b8dc3faa9ea6257ddca952e Author: Wes Carroll Date: Tue Jul 23 12:51:13 2019 -0400 Update Parameter Tests commit 4e7d30ef332bf8c8605234c74f53a839e7cdbe8e Author: Wes Carroll Date: Tue Jul 23 12:30:30 2019 -0400 Add NullOrEmpty validation test commit 27694899390daecac9605cea7b30e708210d8c73 Author: Wes Carroll Date: Tue Jul 23 12:27:11 2019 -0400 Create Parameter Tests commit baf6aa50eec7ac131f217904fee5815e736f3af1 Author: Wes Carroll Date: Mon Jul 22 21:55:28 2019 -0400 Add Parameter Tests commit c96836c0008a9520df2987bc6377e00210de9c09 Author: Wes Carroll Date: Mon Jul 22 21:46:31 2019 -0400 Add Parameter Tests commit 51a1e0fb033953ee27b98fe1f9f45232b0e49a96 Author: Wes Carroll Date: Mon Jul 22 21:27:14 2019 -0400 Add Parameter Tests commit c6b37c24a61b2f7d996cb5667768f1500a16d3b8 Author: Wes Carroll Date: Mon Jul 22 21:22:24 2019 -0400 Add Parameter Tests commit 1d6c2289e831a29460ce2b30ed7f11283b20bd32 Author: Wes Carroll Date: Mon Jul 22 21:20:45 2019 -0400 Add Parameter Tests commit ad6b154d851393d82e8d4b39a2ebe29fe2f883d7 Author: Wes Carroll Date: Mon Jul 22 20:52:34 2019 -0400 Add Parameter Tests commit 28fabd592c058f4cfe6f2fe9aa27140f71ece754 Author: Wes Carroll Date: Mon Jul 22 20:09:03 2019 -0400 Add Parameter Tests commit e7512020103cd1c8eddc56320d8573433cf6ae4e Author: Wes Carroll Date: Mon Jul 22 20:03:52 2019 -0400 Add Parameter Tests commit b5a637fe603f1e7fb6af0f58018bdd3d94b7b595 Author: Wes Carroll Date: Mon Jul 22 19:59:02 2019 -0400 Add Parameter Tests commit b294f3e6ada66c08f07cc175a95e9e775f97a637 Author: Wes Carroll Date: Mon Jul 22 19:54:39 2019 -0400 Add Parameter Tests commit 1be09bd7345181c6cb55598622e8dfba73f443eb Author: Wes Carroll Date: Mon Jul 22 19:52:54 2019 -0400 Add Parameter Tests commit e07b99613e7a6f0b29e0d2410c5a5637aca5d6c3 Author: Wes Carroll Date: Mon Jul 22 17:08:17 2019 -0400 Add Parameter Tests commit 6a924067c9278aadfd86a0cac4c1e77d3faf06ac Author: Wes Carroll Date: Sun Jul 21 20:57:25 2019 -0400 Add Parameter Tests commit d2eddea4bc94e47072a7a8b27440cdcffe525e36 Author: Wes Carroll Date: Sun Jul 21 20:51:01 2019 -0400 Add Parameter Tests commit 5e12656a4a865a2effdb0d76670e0c3cd8156b5b Author: Wes Carroll Date: Sun Jul 21 20:44:35 2019 -0400 Add Parameter Tests commit 96803e1ad560927049df5563231652dcab1f75d1 Author: Wes Carroll Date: Sun Jul 21 20:42:12 2019 -0400 Add Parameter Tests commit 79542e8f7ff7d992b2ff013754454ab6ae9f0c21 Author: Wes Carroll Date: Sun Jul 21 20:41:05 2019 -0400 Add Parameter Tests commit c8da65120058355be03784330046f0a07f686333 Author: Wes Carroll Date: Sun Jul 21 20:37:32 2019 -0400 Add Parameter Tests commit c578ec428ee08744884f8f8846e708930ffa91f1 Author: Wes Carroll Date: Sun Jul 21 20:35:26 2019 -0400 Add Parameter Tests commit 6bc6f902fd4c706be83bdb77ab12ab9948886ae3 Author: Wes Carroll Date: Sun Jul 21 20:33:19 2019 -0400 Add Parameter Tests commit fc3a2a0193eb1abd9f3e6b56fba6ede182c96773 Author: Wes Carroll Date: Sun Jul 21 20:31:53 2019 -0400 Add Parameter Tests commit aaa505c7905cdcec4c4c75e487b72c2ecbee286a Author: Wes Carroll Date: Sun Jul 21 20:30:22 2019 -0400 Add Parameter Tests commit 7fe361dba7c05caa3f4b7b08c640c999701874f6 Author: Wes Carroll Date: Sun Jul 21 20:26:24 2019 -0400 Add Parameter Tests commit 356572a1f8bfb367a11140b3a4477ea30a178c07 Author: Wes Carroll Date: Sun Jul 21 20:24:07 2019 -0400 Add Parameter Tests commit 878622d3e2f91338027af7be95a875a7232d21fa Author: Wes Carroll Date: Sun Jul 21 20:20:31 2019 -0400 Add Parameter Tests commit c83462d03c7afea54bde819c596ee8ac631e0b6c Author: Wes Carroll Date: Sun Jul 21 20:08:54 2019 -0400 Add Parameter Tests commit ba1e1c309e386d68681160e00b699b35a0164438 Author: Wes Carroll Date: Sun Jul 21 19:48:04 2019 -0400 Add Parameter Tests commit 21bc81b0eccb32102dcdaa456164ec9fbb7e293d Author: Wes Carroll Date: Sun Jul 21 18:24:34 2019 -0400 Add Parameter Tests commit 8267474d8acdef51e6b211a0d59dbabc2d465ade Author: Wes Carroll Date: Sun Jul 21 18:24:16 2019 -0400 Update Mandatory Setting for DatastoreId commit fee7cd9723d11bf93f69900e9176e142eee7ad9d Author: Wes Carroll Date: Sun Jul 21 18:16:25 2019 -0400 Add Parameter Validation Tests commit efea4944755c5d604f66ded5cb5c27348ab79fe2 Author: Wes Carroll Date: Sun Jul 21 12:23:27 2019 -0400 Update Parameter Counts commit 9be00e68b1fd3dd1bea5092d932af0a8b484b252 Author: Wes Carroll Date: Sun Jul 21 12:17:33 2019 -0400 Update to new test format commit 928d6ef4a1be7c5e89db175bac1e245f944c3967 Author: Wes Carroll Date: Sun Jul 21 12:09:15 2019 -0400 Update tests to new format commit e1720dd4f772b5fa3a173a33d4d07c8697d8be86 Author: Wes Carroll Date: Sun Jul 21 11:56:03 2019 -0400 Update test description commit 202c865fe8e04050b55df8f0096b59abe255e8ec Author: Wes Carroll Date: Sun Jul 21 11:54:28 2019 -0400 Update tests to new format commit 6df14f7a8d9b551e64639fa860a2f24549765f41 Author: Wes Carroll Date: Sun Jul 21 11:49:08 2019 -0400 Parameter Count Test commit 5213614299aae9f85202c099cf5ceec6bc405d3f Author: Wes Carroll Date: Sun Jul 21 11:36:46 2019 -0400 Add Parameter count test commit a39f2638d1245a14373877f7628eae63ed612f70 Author: Wes Carroll Date: Sun Jul 21 11:36:30 2019 -0400 Update to new test format commit 37016076fde9c710f5bd67a1a9bdc0ed4b75839c Author: Wes Carroll Date: Sat Jul 20 20:56:23 2019 -0400 Update to the new format commit c05a5279826ca7731ff2c1cf812a7b7c45623e2f Author: Wes Carroll Date: Sat Jul 20 20:14:58 2019 -0400 Update tests to new format commit ff54a92f92005d198995d71358cfa6794b4917c8 Author: Wes Carroll Date: Sat Jul 20 20:10:06 2019 -0400 Fix function call var commit b82912605e68f6a2719348ee1f491f85d63aabb5 Author: Wes Carroll Date: Sat Jul 20 20:07:02 2019 -0400 Update tests to new format commit 3e3a4338433db45bfa8ce7818f7673ddd6a8fe06 Author: Wes Carroll Date: Sat Jul 20 20:03:06 2019 -0400 Update tests to new format commit 047e701f5527061d70544d16f554d60180a51526 Author: Wes Carroll Date: Sat Jul 20 20:01:02 2019 -0400 Update tests to new format commit 6b1486b74d5b62b45fa8c4bf6694a609723a09e9 Author: Wes Carroll Date: Sat Jul 20 19:58:48 2019 -0400 Update Tests to new format commit 213329801af8f52fdfb4ba60e9aef8fb2721ccee Author: Wes Carroll Date: Sat Jul 20 19:42:48 2019 -0400 Update Tests to New Format commit 55fb683dc315dd88a8ac9b68caa60ccaab016bde Author: Wes Carroll Date: Sat Jul 20 19:18:46 2019 -0400 Update Tests to TestCases commit 075a78436d4a5d29418e2a5900ac51d48dd2350e Author: Wes Carroll Date: Sat Jul 20 18:35:13 2019 -0400 Add Mock Data Files commit a6d81aca44642ee98a356bace55787774f509f01 Author: Wes Carroll Date: Sat Jul 20 13:49:37 2019 -0400 Refactor Tests commit 9f2a6c42cd95b24d069b2d7b105496ea8664e26e Author: Wes Carroll Date: Sat Jul 20 13:49:03 2019 -0400 Change error to Throw commit a78f827804f10dcc6aed9498a7c3f674000feb28 Author: Wes Carroll Date: Sat Jul 20 13:48:25 2019 -0400 Add Dhcp VRA Mock commit a526045662e1264196ff383ac20245530ebd3468 Author: Wes Carroll Date: Sat Jul 20 13:01:32 2019 -0400 Update Map Function Call commit 6a6b073adadb8a9e655f32b8e6c2dbf3607dade4 Author: Wes Carroll Date: Sat Jul 20 13:00:28 2019 -0400 Redirect Invoke Output to Null commit b11c497eadf6a66342374bdec8ca80ef9c922927 Author: Wes Carroll Date: Sat Jul 20 12:59:12 2019 -0400 Update Exclude Rules commit 344e7836f9437805e18b1f3e588de155e06e8836 Author: Wes Carroll Date: Sat Jul 20 12:57:27 2019 -0400 Update .gitignore commit 1e64d9d7f397828c922b7ababc3d1e3f2e8cc966 Author: Wes Carroll Date: Sat Jul 20 12:57:21 2019 -0400 Renamed Function commit 9ab97f27862f60fa3ed3d98505d94267fcfb4f70 Author: Wes Carroll Date: Sat Jul 20 11:39:05 2019 -0400 Update Test Template for both source and built tests commit 997ab900350b8e51d5a85fab0d1984eb1edf04ef Author: Wes Carroll Date: Sat Jul 20 11:37:22 2019 -0400 Add Mock File for Single VRA Information commit 86ac714c22da6a2258a4f550a1958b10e051a0d0 Author: Wes Carroll Date: Fri Jul 19 14:23:16 2019 -0400 Use TestCases commit 0c4643a76eb697a51822f6de895b528dde8411e4 Author: Wes Carroll Date: Fri Jul 19 14:22:56 2019 -0400 Change ThrowError to Throw commit 1cfc07260f35fd9ea2268b840eac67ab32289684 Author: Wes Carroll Date: Fri Jul 19 14:22:39 2019 -0400 Remove unused BeforAll Block commit 82dbe7ae486acd69eb38f6cd33ead2d5a2d0ba9a Author: Wes Carroll Date: Fri Jul 19 13:47:53 2019 -0400 Update Invoke-ZARestRequest.Tests.ps1 commit 670fbdbba8397abb08a6986ecead9fa149dae904 Author: Wes Carroll Date: Fri Jul 19 11:54:11 2019 -0400 Change ThrowError to Throw commit 2e6a37bd5f708641b35b3681a67447a93c7f0688 Author: Wes Carroll Date: Thu Jul 18 21:25:20 2019 -0400 Update Invoke-ZertoRestRequest.Tests.ps1 commit 1c17ca3e96b7dc1a4567ee62deff28d120b3211c Author: Wes Carroll Date: Thu Jul 18 21:25:18 2019 -0400 Update Invoke-ZertoRestRequest.ps1 commit 6b05af2db427d464cc56fc4944d658230bec4a52 Author: Wes Carroll Date: Tue Jul 16 14:52:22 2019 -0400 Update Invoke-ZARestRequest.Tests.ps1 commit 40326da05fd676f0f62ed53cdb02a45649e9a63e Author: Wes Carroll Date: Tue Jul 16 14:16:06 2019 -0400 Update to ThrowErrors when required vars missing commit db91acb7702e0f0cd3ace6c8a582f565086261d3 Author: Wes Carroll Date: Tue Jul 16 14:11:01 2019 -0400 remove global variables when complete commit 562d1210e6665a539c0f4d641875f688d4dcf1b4 Author: Wes Carroll Date: Mon Jul 15 15:31:44 2019 -0400 Update Tests for Mutlirun commit d7ee3eab122d4a07e3c032c0acba54fbabb50a65 Author: Wes Carroll Date: Mon Jul 15 15:30:54 2019 -0400 Updating Formatting commit 19b645bccc1ac38d7ba7f3ad2fa511976ab5d3b9 Author: Wes Carroll Date: Mon Jul 15 11:48:47 2019 -0400 Exclude Common Parameters in Filter String commit e6c5effe7cd911d2fb28abe7b01eed0214a2d89b Author: Wes Carroll Date: Mon Jul 15 11:48:13 2019 -0400 Specify InputObject Type commit 235434fe2042fecd7f0b5780d06e8b768d40ec98 Author: Wes Carroll Date: Sun Jul 14 20:36:32 2019 -0400 Update function to global variable commit dd144d3c477dc038d61be9ead38fe670ac1b9565 Author: Wes Carroll Date: Sun Jul 14 20:35:47 2019 -0400 Update to use New-Map helper function commit 4fee466cc8a2d4407bc0a952734e0b5ad7e8071d Author: Wes Carroll Date: Sun Jul 14 20:34:53 2019 -0400 Add Mocks for New-Map commit f1afbe6748d133d6f6f5b2b103575d07bf70a4b1 Author: Wes Carroll Date: Sun Jul 14 20:34:26 2019 -0400 Create private helper function New-Map commit 5eae4857cf3b854805c5e73bcf74491a8e6d26fa Author: Wes Carroll Date: Thu Jul 11 18:14:32 2019 -0400 Updating tests for multiuse commit e930f996d656c515de848e50ac114a7c5b6939fb Author: Wes Carroll Date: Thu Jul 11 18:05:53 2019 -0400 Add mock files for testing commit 9a010244b492e6feeb7aad5402d997f441738e46 Author: Wes Carroll Date: Thu Jul 11 07:55:47 2019 -0400 Update to paths commit 7339366f7d8aeb4426c8036b757630a5ed4ee8df Author: Wes Carroll Date: Wed Jul 10 21:19:48 2019 -0400 Update Build Pipeline for Additional Tests commit 7f5fb6c1ac3a0155ce054a0d4f9f7caaec8978d4 Author: Wes Carroll Date: Wed Jul 10 21:10:13 2019 -0400 Update Build Process Versions and Steps commit 46951b76ba4cf2fd1f5c188512825bbfa476114f Author: Wes Carroll Date: Fri Jul 26 08:33:41 2019 -0400 Add missing formatting variable to the Get-ZAVpg function (#41) * Add missing formatting variable * Update ReleaseNotes commit 06b6bb09d7569c6abf700749b159c200e351282a Merge: b2c3548 ddb639a Author: Wes Carroll Date: Tue Jul 9 14:34:40 2019 -0400 Merge pull request #39 from ZertoPublic/NicExportImport Bulk NIC Information Export and Import commit ddb639ad6b122b2623114b61baf0a027f0153956 Author: Wes Carroll Date: Tue Jul 9 13:29:31 2019 -0400 Update RELEASENOTES.md commit 4d7d1391ff07a17329654a61540cf64c60864e07 Author: Wes Carroll Date: Tue Jul 9 13:12:22 2019 -0400 Create function and required supporting docs Import-ZertoVmNicSetting commit cb991b3d0c3e7fb6f197eaa8787eac67b6a6f3aa Author: Wes Carroll Date: Tue Jul 9 12:38:02 2019 -0400 Correct On-line Help Link URI commit 80c82b99e08953f3b8a104ca450fba0960eb73da Author: Wes Carroll Date: Tue Jul 9 11:48:21 2019 -0400 Update to use Export-CSV commit 90cf88b5cbd43349204b543bf86d373fc35351f1 Author: Wes Carroll Date: Mon Jul 8 13:38:48 2019 -0400 Update ZertoApiWrapper.build.ps1 commit ef1584032e20bef8b8ed80e3a65bbaf21f9ba0e6 Author: Wes Carroll Date: Mon Jul 8 13:22:18 2019 -0400 Create function and required associated docs Export-ZertoVmNicSetting commit 1fd92008ac971116080648e85a75f1cd76d9b2b3 Author: Wes Carroll Date: Mon Jul 8 12:55:31 2019 -0400 Update Remove-ZertoVpgSettingsIdentifier.md commit 0a2e6974f018524c4fa13202d1a94bdcd757ad4e Author: Wes Carroll Date: Mon Jul 8 11:59:50 2019 -0400 Create Function and related files Remove-ZertoVpgSettingsIdentifier commit b2c3548d01c55b395c2d5b60aba83a05e07db87c Merge: 148b33c 0b1f2c4 Author: Wes Carroll Date: Tue Jun 25 15:32:27 2019 -0400 Merge pull request #37 from ZertoPublic/ZATokenCheck Add a Token Check to the Invoke-ZARestRequest Private Function commit 0b1f2c4d1b1933c00b07d815996391ecfd789968 Author: Wes Carroll Date: Tue Jun 25 14:02:07 2019 -0400 Update psd1 to export all functions This will not happen in built releases, but just for in-house testing scenarios. commit b7d4664d6b6cb92c4fc9307cd32e2c3060f0503c Author: Wes Carroll Date: Tue Jun 25 14:00:40 2019 -0400 Correct Last Action Variable Name commit 44ed5767ea00bcab0782379d4c803b080beaf47d Author: Wes Carroll Date: Tue Jun 25 08:30:54 2019 -0400 Update Expired Token Error Message commit 83649fb72a582da6138f6ace665350f46ccfb267 Author: Wes Carroll Date: Mon Jun 24 12:47:50 2019 -0400 Add information to release notes. commit 9d579a5785906512694024a83810d17af5fd505d Author: Wes Carroll Date: Mon Jun 24 12:42:23 2019 -0400 Update VSCode settings commit ad8f06c6e1870e727e83b15b9becd4e64fe305ae Author: Wes Carroll Date: Mon Jun 24 12:42:10 2019 -0400 Add Logic for token tests commit 148b33c1e39b0d6f34450172bfc4733eba9e9414 Author: Wes Carroll Date: Wed Jun 19 17:03:23 2019 -0400 Add Issue and PR Templates commit a8025f4be1eead73d0855e59f4ed011c00b400da Author: Wes Carroll Date: Mon Jun 17 09:18:04 2019 -0400 Fix Install CodeBlock commit 9c16c2c6e201c29cffd6b75a08cbfc66e1c8d880 Author: Wes Carroll Date: Mon Jun 17 09:14:10 2019 -0400 Fix CodeBlock Formatting commit f91d16f11aa2e82d30f606dafb2d275aa2684dc0 Merge: 5f5d449 e94c2b6 Author: Wes Carroll Date: Mon Jun 17 09:11:11 2019 -0400 Merge pull request #34 from ZertoPublic/ZertoAnalytics Implements Zerto Analytics Functionality. commit e94c2b66e1db7bc519e4bdcfe9a1861862324f34 Author: Wes Carroll Date: Mon Jun 17 09:07:45 2019 -0400 Ignore Plural Nouns In PSSA commit c08df4c1a0f78cc1ee3d22fb3f77f1121906a399 Author: Wes Carroll Date: Mon Jun 17 08:58:23 2019 -0400 Update for Release commit 82df93143b36d8780a9624d5a6d2651725cf9b09 Author: Wes Carroll Date: Mon Jun 10 17:54:53 2019 -0400 Cleaning InvokeBuild Script commit 59a0112f2c107be22c26c46b383886e732d65352 Author: Wes Carroll Date: Mon Jun 10 17:54:36 2019 -0400 Update RELEASENOTES.md commit c70e0a6701d14132eb06e1edfdad19ab43682817 Author: Wes Carroll Date: Mon Jun 10 17:54:32 2019 -0400 Update README.md commit 598b9027a660db623dde62f1a0d3509a2df66b71 Author: Wes Carroll Date: Mon Jun 10 11:38:36 2019 -0400 Add Interval Parameter commit 8edfb97b1f959bb138a0dd898b6e659e4b95b73f Author: Wes Carroll Date: Mon Jun 10 10:07:13 2019 -0400 Create function and related docs Get-ZANetworkVpgAveragePerformance commit 1ad528c11416052e08b01abe4135a6ee5ab5682f Author: Wes Carroll Date: Mon Jun 10 09:54:33 2019 -0400 Create function and associated docs Get-ZANetwrokVpgAverageIOPS commit a0cc4214ca5ab0e090bc967f0f7d340551bb34e0 Author: Wes Carroll Date: Mon Jun 10 09:54:07 2019 -0400 Add parameter validation commit 2ed0169a0087df646ee6db580e6684654f9f68bb Author: Wes Carroll Date: Mon Jun 10 09:40:00 2019 -0400 Create function and associated docs. Get-ZANetworkVpgSummary commit b0763e965e85b4cf7c8c706c83501a8c607c8ac7 Author: Wes Carroll Date: Mon Jun 10 09:39:36 2019 -0400 Create Function and Required Docs Get-ZANetworkVpgStat commit 5447d1b4436f0340e5ad0beecb603a26b31663bb Author: Wes Carroll Date: Mon Jun 10 09:06:52 2019 -0400 Create Function and associated docs Get-ZANetworkSiteAverageIOPS commit ee4419687a439357d095fbced70886c99bf84271 Author: Wes Carroll Date: Mon Jun 10 09:06:29 2019 -0400 Fix Spelling Error commit dce6d688b7e1259402c42e001ba06837e9575b4f Author: Wes Carroll Date: Mon Jun 10 08:53:48 2019 -0400 Create function and required docs Get-ZANetworkSiteAveragePerformance commit aaed38ee359e65cb06670fe31943b3125e81d3c8 Author: Wes Carroll Date: Mon Jun 10 08:53:29 2019 -0400 Fix filename typo commit d3dbc71a64805b4b2ba1d2f5dcd316b537524cc8 Author: Wes Carroll Date: Mon Jun 10 07:58:57 2019 -0400 Create function and associated docs Get-ZANetworkSiteStat commit ff809b733fd7d090df8db17f3428c896816a5605 Author: Wes Carroll Date: Mon Jun 10 07:58:33 2019 -0400 Correct spelling errors and Add Examples commit 9a2e1c63add1452f934c5a9b22a7cfe77064aadb Author: Wes Carroll Date: Sun Jun 9 16:18:36 2019 -0400 Create Function and Required Docs Get-ZANetworkSiteSummary commit fb7fd5abb80bae708065c9939f0ee9a88c4bc7eb Author: Wes Carroll Date: Sun Jun 9 16:18:09 2019 -0400 Update Parameter Information commit e33b45a274825ed0a990aa5c004816f9c6201c0b Author: Wes Carroll Date: Sun Jun 9 16:06:24 2019 -0400 Correct mis-named variable commit d31b4ce995696abd1fd7d334ddc5de3fe0a39c8d Author: Wes Carroll Date: Sun Jun 9 16:05:47 2019 -0400 Update Mis-named variable commit c6a53688ec7706f4b856c175680df9d55a69e908 Author: Wes Carroll Date: Sun Jun 9 16:04:57 2019 -0400 Correct Parameter Variable Name commit 1da569fa6acf0e9f4df948e9a905c1669cf0ca83 Author: Wes Carroll Date: Sun Jun 9 16:03:31 2019 -0400 Correct Parameter in Help File commit 58e948dfbce1dac03d6d6dccfe12072c1e48d7ae Author: Wes Carroll Date: Sun Jun 9 16:03:02 2019 -0400 Update Help Parameters commit 27c44056a52f64b8a10d6354fa1d1a10dfcbb2c0 Author: Wes Carroll Date: Sun Jun 9 16:02:16 2019 -0400 Create Function and Associated Docs Get-ZASitePair commit 7a80131e950674cb5980eb105e8f54553bfd700c Author: Wes Carroll Date: Sun Jun 9 15:31:09 2019 -0400 Create Function and required docs Get-ZAJournalSiteHistorySummary commit 8b6f4999b2ffcb1a522386254f8603e237761de7 Author: Wes Carroll Date: Sun Jun 9 15:27:02 2019 -0400 Create Function and Required Docs Get-ZAJournalSiteSizeStat commit a74bc14e306b0dd60c74fd5d2e187cbfe41a2ca7 Author: Wes Carroll Date: Sun Jun 9 15:26:28 2019 -0400 Function Rename commit 108cb12439ae2f304f14b87f1b8ac9b92e81ef77 Author: Wes Carroll Date: Sun Jun 9 15:26:14 2019 -0400 Function Rename commit d2b559ec83d9110f90c19065014bd44a85aa67e5 Author: Wes Carroll Date: Sun Jun 9 15:25:36 2019 -0400 Function Rename commit 5bd2d83cc898e1ab2c576f899ec8ada2300b21d1 Author: Wes Carroll Date: Sun Jun 9 15:07:40 2019 -0400 Create function and associated docs Get-ZAJournalHistorySiteStat commit eb528e3432a446c437061f2f87c2b209a9c478a9 Author: Wes Carroll Date: Sun Jun 9 14:58:04 2019 -0400 Create Function and Required Docs Get-ZAJournalAverageSize commit aeeaf73da0f29e72b9df0bfa4bf10bbda0a7f6e8 Author: Wes Carroll Date: Sun Jun 9 14:57:38 2019 -0400 Correct Parameter Error commit 1110fcc56aed6ea4705f2273beb98ca013f4b2c8 Author: Wes Carroll Date: Sun Jun 9 14:51:38 2019 -0400 Create Function and required docs Get-JournalAverageSize commit ca2620d9b588e047e7ac8083fec473a4abc5012e Author: Wes Carroll Date: Sun Jun 9 14:51:16 2019 -0400 Create function and required docs Get-ZAJournalAverageSiteHistory commit d46869353b57eace7d06da6ee92da49a364b64da Author: Wes Carroll Date: Sun Jun 9 14:50:54 2019 -0400 Create Function and Required Docs Get-ZAJournalAverageHistory commit 0fda0c1e78fbe0ca164bdea6fe5f0aa4ad4e85b2 Author: Wes Carroll Date: Sun Jun 9 12:49:45 2019 -0400 Create Function and Docs Get-ZAJournalStatusProportion commit 0226fdd432f99111c5f102579824319831a09bd3 Author: Wes Carroll Date: Sun Jun 9 12:49:09 2019 -0400 Fix Function Name Typos in Docs commit b934e28657a50901b43869e0228c368fcea00425 Author: Wes Carroll Date: Sun Jun 9 12:41:55 2019 -0400 Create Get-ZAJournalHistoryStat and Docs commit ced00662441c55361a098f85c1d1b2e6e961c3b6 Author: Wes Carroll Date: Sun Jun 9 12:41:42 2019 -0400 Create Get-ZAJournalBreach and Docs commit 6ab9a2dae66b351fa9b511515e8efde18726ab71 Author: Wes Carroll Date: Sun Jun 9 12:32:50 2019 -0400 Create Get-ZAJournalStorage Stat and Docs commit bb6de17e7cca21023da9e2ef82d9a57252c0ead7 Author: Wes Carroll Date: Sun Jun 9 12:25:07 2019 -0400 Create Get-ZAJournalSummary and Docs commit 89bfe61a1b35688399e8e5323ffc52c7718cd0d7 Author: Wes Carroll Date: Sun Jun 9 12:18:11 2019 -0400 Add Parameter Validation commit 72cbe0eb29d406dd5e1ef9d767ca5634cd9b678a Author: Wes Carroll Date: Sun Jun 9 12:02:25 2019 -0400 Create Get-ZARPOAverage and Required Docs commit 80bad682389a400b76f87829a7ee7e40b43586a8 Author: Wes Carroll Date: Sun Jun 9 12:02:06 2019 -0400 Update Related Links description commit e80fab4eac1aedbd1a263d50c6753acba9241931 Author: Wes Carroll Date: Sun Jun 9 11:52:21 2019 -0400 Fix Function Name Typo commit f3d07003b4afb3a924d69ee977126e24ae1763c6 Author: Wes Carroll Date: Sun Jun 9 11:17:07 2019 -0400 Create Get-ZARPOAccountAverage and Docs commit 675c43b35e1e001836eabb66405bda05e74c2d6d Author: Wes Carroll Date: Sun Jun 9 10:12:00 2019 -0400 Create Get-ZARPOStatusProportion and Docs commit b22345dc631c09588bde73fffdb2bca5fb6732a2 Author: Wes Carroll Date: Sun Jun 9 10:02:50 2019 -0400 Create Get-ZARPOBreach and required docs. commit 1c9a5bb6cb993b853b16d653ec186d0022177a16 Author: Wes Carroll Date: Sun Jun 9 09:59:05 2019 -0400 Fix Get-ZARPOStat issues with tests and docs commit 9262f1b42de7defea421d6d3631699804075a82b Author: Wes Carroll Date: Sun Jun 9 09:50:35 2019 -0400 Create Get-ZARPOStat and required docs commit f7fff2248e22b9ce3849712f78518cd0f4cbf7b5 Author: Wes Carroll Date: Sun Jun 9 08:56:04 2019 -0400 Create Get-ZARPOSummary and Docs commit 358d680c72d935d839ecf2e4f43708eb5d130c87 Author: Wes Carroll Date: Sat Jun 8 16:11:04 2019 -0400 Remove AlertAggregation Remove AlertAggregation, Will add aggregation into Alert down the road. commit f0fb1d4fc6bf38703785660d142065c9b52dcdf7 Author: Wes Carroll Date: Sat Jun 8 16:09:10 2019 -0400 Add required External Help Line commit 35b03a963f0daf2b619ca637afb1fa96ff52a15d Author: Wes Carroll Date: Sat Jun 8 16:08:57 2019 -0400 Update Help File commit c83eb2d8a71557c85e5d26c807e5f446c391e145 Author: Wes Carroll Date: Sat Jun 8 16:08:25 2019 -0400 Create Get-ZAVolume and required files commit a475eee47a3a4afce2eda2cf6be846f94328aef6 Merge: 1008c2c 1f03feb Author: Wes Carroll Date: Thu Jun 6 17:55:01 2019 -0400 Resolving Merge Conflicts commit 1f03feb1c68b909269b3b3b5e584dee6d86c27b8 Author: Wes Carroll Date: Thu Jun 6 14:29:22 2019 -0400 Create Get-ZADatastore function & supporting docs commit c88d175fd0da6e359c2ecdab22fd9f01d5b78021 Author: Wes Carroll Date: Thu Jun 6 13:59:41 2019 -0400 Correct Help Message Typo commit 0e148bdb1b2314d1bd64ce6b4f6a503d94f97411 Author: Wes Carroll Date: Thu Jun 6 13:59:13 2019 -0400 Create Get-ZATask files and content commit 4fc6c9ebcd7c2007a17ca9108a89e732bd1605c2 Author: Wes Carroll Date: Thu Jun 6 13:36:04 2019 -0400 Create Get-ZAEvent Files commit 7ec6d846c0ba2e896ceb236a186f700cf0ff7f84 Author: Wes Carroll Date: Thu Jun 6 12:30:01 2019 -0400 Create External Help File for Get-ZAzOrg Function commit f2d2e00f12db2f6595bdbdf90fb31dbe09bace28 Author: Wes Carroll Date: Thu Jun 6 12:28:07 2019 -0400 Create Get-ZAVpg External Help File commit 2c891795b2fcb664fac60bee7c9dcc011bcee0ec Author: Wes Carroll Date: Thu Jun 6 11:57:05 2019 -0400 Add Online Parameter URL commit 9799feaeea545f2568cac8eeef69771020103ffe Author: Wes Carroll Date: Thu Jun 6 11:50:09 2019 -0400 Formatting Update commit cddd25ded1b5204b341319a985cdfa55e28fd858 Author: Wes Carroll Date: Thu Jun 6 11:49:49 2019 -0400 Formatting Update commit ebc86c5e7164376521efaaad679f61aa5f607689 Author: Wes Carroll Date: Thu Jun 6 11:48:49 2019 -0400 Update Function to set variable to mandatory commit a3fd87f933fecf7c573811212acada3691a2d97f Author: Wes Carroll Date: Thu Jun 6 11:46:49 2019 -0400 Create Get-ZASiteTopology Markdown Help File commit 6d66a1c35b139910ee21fce225114adb402aaeaf Author: Wes Carroll Date: Thu Jun 6 11:44:04 2019 -0400 Create Get-ZASite Markdown help file commit 8b09b702d61781cdb64b0ab2ccbd5cda6045582b Author: Wes Carroll Date: Thu Jun 6 11:42:01 2019 -0400 Create Get-ZAMonitoring Markdown Help file commit 0fbc6d2242f2ea72fab38b78b653903e5362dbdb Author: Wes Carroll Date: Thu Jun 6 11:35:41 2019 -0400 Create Get-ZALicense Markdown Help File commit f0f45a383f40ff9efc2c88d0264d221013462a4d Author: Wes Carroll Date: Thu Jun 6 11:34:27 2019 -0400 Create Get-ZAAlert Markdown Help File commit d8084b2fb3a01e5c748e954b2797b53a46900d95 Author: Wes Carroll Date: Thu Jun 6 11:31:55 2019 -0400 Formatting Update commit 5990d57285bd69dd87b33bf2916d20960efb8667 Author: Wes Carroll Date: Thu Jun 6 11:31:44 2019 -0400 Fix variable Typo commit 8581c037d719812f9d6d47679765c9a49ac7de74 Author: Wes Carroll Date: Thu Jun 6 11:20:29 2019 -0400 Add task to update the Markdown help files with new commands. commit ba4f0fc82a399b4dd2615dc583803f2c9a14cd8c Author: Wes Carroll Date: Thu Jun 6 11:20:01 2019 -0400 Create Connect-ZertoAnalytics.md commit 70261242db7497a6a37079f3dc8f2be9957df3b5 Author: Wes Carroll Date: Wed Jun 5 15:55:28 2019 -0400 Update Invoke-ZertoFailoverCommit.md commit bc9e485346d2352cac1631c06c16a33df0cb7641 Author: Wes Carroll Date: Wed Jun 5 15:41:31 2019 -0400 Update Invoke-ZertoFailoverCommit.md Add SupportShouldProcess commit 8d5111a24a0e506cf4389370ef2ba0a6c4ae8746 Author: Wes Carroll Date: Wed Jun 5 14:20:13 2019 -0400 Create Get-ZAzOrg Function and Tests commit 87857303a03adac5e3ae64fee3a3e1ef5ca5c334 Author: Wes Carroll Date: Wed Jun 5 14:19:34 2019 -0400 Create Get-ZAVpg Function and Tests commit 97aa9f1ba80abd035c542df264d0365309345482 Author: Wes Carroll Date: Wed Jun 5 14:18:57 2019 -0400 Create Get-ZASiteTopology Function and Tests commit 5018404641d22cec04c216b205251d9ccbcd64f7 Author: Wes Carroll Date: Wed Jun 5 14:18:16 2019 -0400 Create Get-ZASite Function and Tests commit e43e911c7b177fcc4f7302bcb661ea41429ac291 Author: Wes Carroll Date: Wed Jun 5 14:17:41 2019 -0400 Create Get-ZAAlertAggregation Function and Tests commit 15435c9261c4386d819ac6a7f7d83a424387957e Author: Wes Carroll Date: Wed Jun 5 14:16:43 2019 -0400 Create Get-ZAAlert Function and Tests commit 848daf3c49f02a8192198501c480aab0a352e311 Author: Wes Carroll Date: Wed Jun 5 14:13:31 2019 -0400 Create ZAMonitoring Function and Tests commit b4246057350b53270a3ffac0b751cbf5da5faaa1 Author: Wes Carroll Date: Wed Jun 5 14:12:36 2019 -0400 Create Get-ZALicense.Tests.ps1 commit 5f24cc8c73c7508197e17d675e943943604d7515 Author: Wes Carroll Date: Wed Jun 5 14:08:45 2019 -0400 Make into an advanced function. commit c78ad3e696c93c0f5c30d54b6d37e2104a94185b Author: Wes Carroll Date: Wed Jun 5 14:08:06 2019 -0400 Create Connect-ZertoAnalytics.Tests.ps1 commit ab39ba70a2144186a159a1412149726d7729f68a Author: Wes Carroll Date: Wed Jun 5 14:07:58 2019 -0400 Create Invoke-ZARestRequest.Tests.ps1 commit 934f02664489bff524d3361c3d6d82996ccf6eea Author: Wes Carroll Date: Wed Jun 5 14:07:37 2019 -0400 Add External Help File commit 183bbc7d1314ac6a7398139430f93eceb75fe43e Author: Wes Carroll Date: Mon Jun 3 07:11:33 2019 -0400 Create Get-ZALicense.ps1 commit 6a32ed6e14d7a35c48c7df85f115230449d6303c Author: Wes Carroll Date: Mon Jun 3 07:11:20 2019 -0400 Create Connect-ZertoAnalytics.ps1 commit 79fe7de886fcbe7f0d76d75661a4b89962b3c246 Author: Wes Carroll Date: Mon Jun 3 07:11:15 2019 -0400 Create Invoke-ZARestRequest.ps1 commit 5f5d4497be4cf7718ecfa901761e72dba4847819 Merge: 1c630ed 8365083 Author: Wes Carroll Date: Thu Jun 6 10:51:24 2019 -0400 Merge pull request #33 from ZertoPublic/add-code-of-conduct-1 Create CODE_OF_CONDUCT.md commit 83650838143350d589b1163c1684952002808b5c Author: Wes Carroll Date: Thu Jun 6 10:32:00 2019 -0400 Create CODE_OF_CONDUCT.md commit 1008c2c67047b608b4fa87f30071340ba9a169bc Author: Wes Carroll Date: Wed Jun 5 15:41:31 2019 -0400 Update Invoke-ZertoFailoverCommit.md Add SupportShouldProcess commit fd2d175def0a5e60dc53fe07971e59a9913d12c9 Author: Wes Carroll Date: Wed Jun 5 14:20:13 2019 -0400 Create Get-ZAzOrg Function and Tests commit 1b331105b90105bb8e27c545f94f45fb2487647c Author: Wes Carroll Date: Wed Jun 5 14:19:34 2019 -0400 Create Get-ZAVpg Function and Tests commit 0f35782f66699bfb4f62dee84875a23a7d4005e6 Author: Wes Carroll Date: Wed Jun 5 14:18:57 2019 -0400 Create Get-ZASiteTopology Function and Tests commit bcc5c49b711c6e4cc8bb1443298c0695591dfb5f Author: Wes Carroll Date: Wed Jun 5 14:18:16 2019 -0400 Create Get-ZASite Function and Tests commit ee7770e1e96d3f360ff1004ef2cc9eede7724fc5 Author: Wes Carroll Date: Wed Jun 5 14:17:41 2019 -0400 Create Get-ZAAlertAggregation Function and Tests commit 58a3500dddc14a4e4171fbbfb2c42e6247e5dc88 Author: Wes Carroll Date: Wed Jun 5 14:16:43 2019 -0400 Create Get-ZAAlert Function and Tests commit 50354f10cf02fce296edcbfd629f6951d2f76b5a Author: Wes Carroll Date: Wed Jun 5 14:13:31 2019 -0400 Create ZAMonitoring Function and Tests commit 04b8b9837b442772d46b9c5852bd3cc5e59c412b Author: Wes Carroll Date: Wed Jun 5 14:12:36 2019 -0400 Create Get-ZALicense.Tests.ps1 commit ce5a37ceb62a5da601fbaef570943e11d0660089 Author: Wes Carroll Date: Wed Jun 5 14:08:45 2019 -0400 Make into an advanced function. commit 947fbe64681fb0b283931fb990b94474ae4a0dda Author: Wes Carroll Date: Wed Jun 5 14:08:06 2019 -0400 Create Connect-ZertoAnalytics.Tests.ps1 commit 1ef5d63cf7adeff2086d5ec29aeb86dd13573bcf Author: Wes Carroll Date: Wed Jun 5 14:07:58 2019 -0400 Create Invoke-ZARestRequest.Tests.ps1 commit 14424c6b51db5de1af77004036d2c51e8af98f30 Author: Wes Carroll Date: Wed Jun 5 14:07:37 2019 -0400 Add External Help File commit b22481e3b0f1ee285e2e6772778e7ab844cc05ef Author: Wes Carroll Date: Mon Jun 3 07:11:33 2019 -0400 Create Get-ZALicense.ps1 commit a1a4a7882060ac41fe5c262d9ae1ada3c576e18b Author: Wes Carroll Date: Mon Jun 3 07:11:20 2019 -0400 Create Connect-ZertoAnalytics.ps1 commit ca5d357d2f1238066d4d4f0a8068c15aae820fc6 Author: Wes Carroll Date: Mon Jun 3 07:11:15 2019 -0400 Create Invoke-ZARestRequest.ps1 commit 1c630edc8e6c670621d68faecfc5a8ad0b8179a9 Merge: 23ad240 5713fcd Author: Wes Carroll Date: Sat Jun 1 22:51:50 2019 -0400 Merge pull request #32 from ZertoPublic/PowerShellBackPort PowerShell back port commit 5713fcd02ceb0cdfec6593f42b3cab589fe594f7 Author: Wes Carroll Date: Fri May 31 17:03:26 2019 -0400 Getting Ready for Release to PSGallery commit b18da2e79bede88219dfdd2de6921ba6ceffd4df Author: Wes Carroll Date: Fri May 31 17:03:10 2019 -0400 Refelect 5.1 Update commit 6b73f0bcce2ee0cb6361beabbc14fe7f75c1eabc Author: Wes Carroll Date: Fri May 31 10:32:12 2019 -0400 Update GitHub URLs to Reflect ZertoPublic Project commit 8763be768d572824559c57c771c285ad46e23cc0 Author: Wes Carroll Date: Fri May 31 10:01:50 2019 -0400 Update AzPipelines to run PowerShell 5.1 Tests commit fa043df02ff2edf27f676994689c2433077fb029 Author: Wes Carroll Date: Fri May 31 09:39:54 2019 -0400 Request Logic to support Windows PowerShell Added logic needed to support Windows PowerShell including a Certificate Bypass. May move this into a function later to cllean the module a bit. commit 51064c5d648fe76cf0019b68d3f27e4a96466dd1 Author: Wes Carroll Date: Fri May 31 09:38:48 2019 -0400 Update Minimum PowerShellVersion to 5.1.0 commit 23ad240a5221e0837bf95f4a2e750189a8230510 Merge: dae010c 2761276 Author: Wes Carroll Date: Tue May 21 09:35:27 2019 -0500 Merge pull request #31 from ZertoPublic/MoreTests Update Get-ZertoLocalSite.Tests.ps1 commit dae010c262ccdcb38acfcd85edd44e7826a15c81 Author: Wes Carroll Date: Mon May 20 08:46:32 2019 -0500 Update README.md Update Build Status to New Project Location commit 27612761b40dd53463c8b53506ca7ee5fb99f5d4 Author: Wes Carroll Date: Sun May 19 17:52:32 2019 -0500 Update Get-ZertoLocalSite.Tests.ps1 commit 8533cb98bd3233e43af4eb96e6a621a961471874 Merge: f2ab959 28c3511 Author: Wes Carroll Date: Sun May 19 17:33:03 2019 -0500 Merge pull request #30 from wcarroll/Hackathon Hackathon commit 28c35115eb192da479d5f4976c8b345250d0c982 Author: Wes Carroll Date: Sun May 19 17:01:36 2019 -0500 Update Get-ZertoDatastore.Tests.ps1 commit 2465305ddf7d4cabcb323626221593b9677b2189 Author: Wes Carroll Date: Sun May 19 16:52:44 2019 -0500 Update Get-ZertoAlert.Tests.ps1 commit 4de751bc3dabe397d70dee93e87d0e008a08c401 Author: Wes Carroll Date: Sun May 19 16:52:36 2019 -0500 Typo Fix commit 98aedca37316b091bbfa461c29199a5b43c46840 Author: Wes Carroll Date: Sun May 19 16:24:39 2019 -0500 Update Parameter Tests commit f2ab959b93965c13f6c70e21e28a3e0c07e84895 Author: Wes Carroll Date: Sun May 19 15:35:15 2019 -0500 Add Parameter Tests commit 17275b1191a309ea4cdd00a72d40949ce5814add Author: Wes Carroll Date: Sun May 19 15:34:55 2019 -0500 Move Move Logic to Process Block --- .github/CONTRIBUTING.md | 62 ++++ .github/ISSUE_TEMPLATE.md | 31 ++ .github/PULL_REQUEST_TEMPLATE.md | 37 +++ .gitignore | 6 +- .vscode/settings.json | 7 +- CHANGELOG.md | 159 ++++++++++ CODE_OF_CONDUCT.md | 76 +++++ README.md | 58 ++-- RELEASENOTES.md | 6 - Tests/Private/Get-Map.Tests.ps1 | 70 +++++ Tests/Private/Get-ZertoApiFilter.Tests.ps1 | 96 ++++-- .../Private/Invoke-ZertoRestRequest.Tests.ps1 | 17 -- Tests/Private/Mocks/ProtectedVMs.json | 15 + Tests/Public/Add-ZertoPeerSite.Tests.ps1 | 122 ++++---- Tests/Public/Add-ZertoVpgVm.Tests.ps1 | 53 ++++ Tests/Public/Checkpoint-ZertoVpg.Tests.ps1 | 81 +++-- Tests/Public/Connect-ZertoAnalytics.Tests.ps1 | 72 +++++ Tests/Public/Connect-ZertoServer.Tests.ps1 | 217 +++++--------- Tests/Public/Copy-ZertoVpg.Tests.ps1 | 127 ++++++++ Tests/Public/Disconnect-ZertoServer.Tests.ps1 | 57 ++-- Tests/Public/Edit-ZertoVra.Tests.ps1 | 224 +++++--------- .../Public/Export-ZertoVmNicSetting.Tests.ps1 | 32 ++ Tests/Public/Export-ZertoVpg.Tests.ps1 | 79 +++-- Tests/Public/Get-ZAAlert.Tests.ps1 | 58 ++++ Tests/Public/Get-ZADatastore.Tests.ps1 | 44 +++ Tests/Public/Get-ZAEvent.Tests.ps1 | 77 +++++ .../Get-ZAJournalAverageHistory.Tests.ps1 | 59 ++++ .../Public/Get-ZAJournalAverageSize.Tests.ps1 | 58 ++++ Tests/Public/Get-ZAJournalBreach.Tests.ps1 | 44 +++ .../Public/Get-ZAJournalHistoryStat.Tests.ps1 | 44 +++ .../Get-ZAJournalSiteAverageHistory.Tests.ps1 | 58 ++++ .../Get-ZAJournalSiteAverageSize.Tests.ps1 | 58 ++++ .../Get-ZAJournalSiteHistoryStat.Tests.ps1 | 58 ++++ .../Get-ZAJournalSiteHistorySummary.Tests.ps1 | 58 ++++ .../Get-ZAJournalSiteSizeStat.Tests.ps1 | 58 ++++ .../Get-ZAJournalStatusProportion.Tests.ps1 | 44 +++ .../Public/Get-ZAJournalStorageStat.Tests.ps1 | 44 +++ Tests/Public/Get-ZAJournalSummary.Tests.ps1 | 44 +++ Tests/Public/Get-ZALicense.Tests.ps1 | 19 ++ Tests/Public/Get-ZAMonitoring.Tests.ps1 | 24 ++ .../Get-ZANetworkSiteAverageIOPS.Tests.ps1 | 60 ++++ ...-ZANetworkSiteAveragePerformance.Tests.ps1 | 60 ++++ Tests/Public/Get-ZANetworkSiteStat.Tests.ps1 | 51 ++++ .../Public/Get-ZANetworkSiteSummary.Tests.ps1 | 51 ++++ .../Get-ZANetworkVpgAverageIOPS.Tests.ps1 | 58 ++++ ...t-ZANetworkVpgAveragePerformance.Tests.ps1 | 58 ++++ Tests/Public/Get-ZANetworkVpgStat.Tests.ps1 | 49 ++++ .../Public/Get-ZANetworkVpgSummary.Tests.ps1 | 49 ++++ .../Get-ZAPlannerJournalSizeReport.Tests.ps1 | 57 ++++ ...APlannerNetworkPerformanceReport.Tests.ps1 | 57 ++++ Tests/Public/Get-ZAPlannerSite.Tests.ps1 | 42 +++ .../Public/Get-ZAPlannerStatsReport.Tests.ps1 | 57 ++++ Tests/Public/Get-ZAPlannerWanReport.Tests.ps1 | 56 ++++ .../Public/Get-ZAPlannerZcasReport.Tests.ps1 | 56 ++++ Tests/Public/Get-ZAProtectedVm.Tests.ps1 | 41 +++ .../Public/Get-ZAProtectedVmReport.Tests.ps1 | 39 +++ .../Public/Get-ZARPOAccountAverage.Tests.ps1 | 44 +++ Tests/Public/Get-ZARPOAverage.Tests.ps1 | 58 ++++ Tests/Public/Get-ZARPOBreach.Tests.ps1 | 44 +++ Tests/Public/Get-ZARPOStat.Tests.ps1 | 44 +++ .../Get-ZARPOStatusProportion.Tests.ps1 | 44 +++ Tests/Public/Get-ZARPOSummary.Tests.ps1 | 44 +++ Tests/Public/Get-ZASite.Tests.ps1 | 28 ++ Tests/Public/Get-ZASitePair.Tests.ps1 | 44 +++ Tests/Public/Get-ZASiteTopology.Tests.ps1 | 42 +++ Tests/Public/Get-ZATask.Tests.ps1 | 57 ++++ Tests/Public/Get-ZAVolume.Tests.ps1 | 45 +++ Tests/Public/Get-ZAVpg.Tests.ps1 | 43 +++ Tests/Public/Get-ZAzOrg.Tests.ps1 | 19 ++ Tests/Public/Get-ZertoAlert.Tests.ps1 | 62 ++-- Tests/Public/Get-ZertoDatastore.Tests.ps1 | 36 ++- Tests/Public/Get-ZertoEvent.Tests.ps1 | 135 +++++++-- Tests/Public/Get-ZertoLicense.Tests.ps1 | 30 +- Tests/Public/Get-ZertoLocalSite.Tests.ps1 | 35 ++- Tests/Public/Get-ZertoPeerSite.Tests.ps1 | 68 +++-- Tests/Public/Get-ZertoProtectedVm.Tests.ps1 | 28 +- .../Public/Get-ZertoRecoveryReport.Tests.ps1 | 28 +- .../Public/Get-ZertoResourcesReport.Tests.ps1 | 28 +- .../Public/Get-ZertoServiceProfile.Tests.ps1 | 28 +- Tests/Public/Get-ZertoTask.Tests.ps1 | 28 +- Tests/Public/Get-ZertoUnprotectedVm.Tests.ps1 | 28 +- .../Get-ZertoVirtualizationSite.Tests.ps1 | 276 ++++++++++++++++-- Tests/Public/Get-ZertoVolume.Tests.ps1 | 29 +- Tests/Public/Get-ZertoVpg.Tests.ps1 | 28 +- Tests/Public/Get-ZertoVpgSetting.Tests.ps1 | 28 +- Tests/Public/Get-ZertoVra.Tests.ps1 | 28 +- Tests/Public/Get-ZertoZorg.Tests.ps1 | 28 +- Tests/Public/Get-ZertoZsspSession.Tests.ps1 | 28 +- .../Public/Import-ZertoVmNicSetting.Tests.ps1 | 30 ++ Tests/Public/Import-ZertoVpg.Tests.ps1 | 41 +-- Tests/Public/Install-ZertoVra.Tests.ps1 | 153 ++++------ Tests/Public/Invoke-ZARestRequest.Tests.ps1 | 90 ++++++ .../Public/Invoke-ZertoEvacuateVra.Tests.ps1 | 54 ++++ Tests/Public/Invoke-ZertoFailover.Tests.ps1 | 136 +++++---- .../Invoke-ZertoFailoverCommit.Tests.ps1 | 76 +++-- .../Invoke-ZertoFailoverRollback.Tests.ps1 | 36 ++- Tests/Public/Invoke-ZertoForceSync.Tests.ps1 | 37 ++- Tests/Public/Invoke-ZertoMove.Tests.ps1 | 98 +++++-- Tests/Public/Invoke-ZertoMoveCommit.Tests.ps1 | 71 +++-- .../Public/Invoke-ZertoMoveRollback.Tests.ps1 | 36 ++- .../Public/Invoke-ZertoRestRequest.Tests.ps1 | 89 ++++++ Tests/Public/Mocks/AuthHeaders.json | 23 ++ Tests/Public/Mocks/CopyVpgSettings.json | 79 +++++ Tests/Public/Mocks/GetDhcpVra.json | 50 ++++ Tests/Public/Mocks/GetSingleVra.json | 50 ++++ Tests/Public/Mocks/GetVpg.json | 75 +++++ Tests/Public/Mocks/LocalSiteInfo.json | 20 ++ Tests/Public/Mocks/PairingToken.json | 4 + Tests/Public/Mocks/ProtectedVms.json | 274 +++++++++++++++++ Tests/Public/Mocks/TaskId.txt | 1 + Tests/Public/Mocks/UnprotectedVms.json | 18 ++ Tests/Public/Mocks/VPGInfo.json | 75 +++++ Tests/Public/Mocks/VirtualSite-Folders.json | 14 + Tests/Public/Mocks/VirtualSite-Networks.json | 4 + Tests/Public/Mocks/VirtualSite-NoParams.json | 10 + .../Mocks/VirtualSite-ResourcePools.json | 4 + Tests/Public/Mocks/VirtualSite-SiteId.json | 4 + Tests/Public/Mocks/VirtualSite-VMs.json | 18 ++ .../Mocks/VirtualSite-datastoreClusters.json | 4 + .../Public/Mocks/VirtualSite-datastores.json | 34 +++ .../Mocks/VirtualSite-devices-hostid.json | 62 ++++ Tests/Public/Mocks/VirtualSite-devices.json | 62 ++++ .../Mocks/VirtualSite-hostClusters.json | 4 + .../Mocks/VirtualSite-hosts-hostid.json | 4 + Tests/Public/Mocks/VirtualSite-hosts.json | 14 + .../Mocks/VirtualSite-repositories.json | 7 + Tests/Public/Mocks/VpgId.txt | 1 + Tests/Public/Mocks/ZAToken.json | 4 + Tests/Public/New-ZertoPairingToken.Tests.ps1 | 51 ++++ Tests/Public/New-ZertoVpg.Tests.ps1 | 28 +- .../New-ZertoVpgSettingsIdentifier.Tests.ps1 | 28 +- Tests/Public/Remove-ZertoPeerSite.Tests.ps1 | 28 +- Tests/Public/Remove-ZertoVpg.Tests.ps1 | 28 +- ...emove-ZertoVpgSettingsIdentifier.Tests.ps1 | 17 ++ Tests/Public/Remove-ZertoVpgVm.Tests.ps1 | 52 ++++ Tests/Public/Resume-ZertoVpg.Tests.ps1 | 28 +- Tests/Public/Save-ZertoVpgSetting.Tests.ps1 | 28 +- Tests/Public/Set-ZertoAlert.Tests.ps1 | 28 +- Tests/Public/Set-ZertoLicense.Tests.ps1 | 28 +- .../Public/Set-ZertoUserCredential.Tests.ps1 | 42 +++ Tests/Public/Start-ZertoCloneVpg.Tests.ps1 | 28 +- .../Public/Start-ZertoFailoverTest.Tests.ps1 | 28 +- Tests/Public/Stop-ZertoCloneVpg.Tests.ps1 | 28 +- Tests/Public/Stop-ZertoFailoverTest.Tests.ps1 | 28 +- Tests/Public/Suspend-ZertoVpg.Tests.ps1 | 28 +- Tests/Public/Uninstall-ZertoVra.Tests.ps1 | 28 +- Tests/ZertoApiWrapper.Tests.ps1 | 22 +- ZertoApiWrapper.Depend.psd1 | 6 +- ZertoApiWrapper.build.ps1 | 183 +++++++----- ZertoApiWrapper/Private/Get-Map.ps1 | 21 ++ .../Private/Get-ZertoApiFilter.ps1 | 36 ++- .../Private/Invoke-ZertoRestRequest.ps1 | 48 --- ZertoApiWrapper/Public/Add-ZertoPeerSite.ps1 | 19 +- ZertoApiWrapper/Public/Add-ZertoVpgVm.ps1 | 104 +++++++ .../Public/Checkpoint-ZertoVpg.ps1 | 26 +- .../Public/Connect-ZertoAnalytics.ps1 | 20 ++ .../Public/Connect-ZertoServer.ps1 | 40 ++- ZertoApiWrapper/Public/Copy-ZertoVpg.ps1 | 59 ++++ .../Public/Disconnect-ZertoServer.ps1 | 3 +- ZertoApiWrapper/Public/Edit-ZertoVra.ps1 | 32 +- .../Public/Export-ZertoVmNicSetting.ps1 | 83 ++++++ ZertoApiWrapper/Public/Export-ZertoVpg.ps1 | 7 +- ZertoApiWrapper/Public/Get-ZAAlert.ps1 | 39 +++ ZertoApiWrapper/Public/Get-ZADatastore.ps1 | 39 +++ ZertoApiWrapper/Public/Get-ZAEvent.ps1 | 39 +++ .../Public/Get-ZAJournalAverageHistory.ps1 | 31 ++ .../Public/Get-ZAJournalAverageSize.ps1 | 31 ++ .../Public/Get-ZAJournalBreach.ps1 | 26 ++ .../Public/Get-ZAJournalHistoryStat.ps1 | 26 ++ .../Get-ZAJournalSiteAverageHistory.ps1 | 31 ++ .../Public/Get-ZAJournalSiteAverageSize.ps1 | 31 ++ .../Public/Get-ZAJournalSiteHistoryStat.ps1 | 31 ++ .../Get-ZAJournalSiteHistorySummary.ps1 | 31 ++ .../Public/Get-ZAJournalSiteSizeStat.ps1 | 31 ++ .../Public/Get-ZAJournalStatusProportion.ps1 | 26 ++ .../Public/Get-ZAJournalStorageStat.ps1 | 26 ++ .../Public/Get-ZAJournalSummary.ps1 | 26 ++ ZertoApiWrapper/Public/Get-ZALicense.ps1 | 7 + ZertoApiWrapper/Public/Get-ZAMonitoring.ps1 | 18 ++ .../Public/Get-ZANetworkSiteAverageIOPS.ps1 | 53 ++++ .../Get-ZANetworkSiteAveragePerformance.ps1 | 52 ++++ .../Public/Get-ZANetworkSiteStat.ps1 | 47 +++ .../Public/Get-ZANetworkSiteSummary.ps1 | 47 +++ .../Public/Get-ZANetworkVpgAverageIOPS.ps1 | 31 ++ .../Get-ZANetworkVpgAveragePerformance.ps1 | 31 ++ .../Public/Get-ZANetworkVpgStat.ps1 | 26 ++ .../Public/Get-ZANetworkVpgSummary.ps1 | 26 ++ .../Public/Get-ZAPlannerJournalSizeReport.ps1 | 58 ++++ .../Get-ZAPlannerNetworkPerformanceReport.ps1 | 58 ++++ ZertoApiWrapper/Public/Get-ZAPlannerSite.ps1 | 22 ++ .../Public/Get-ZAPlannerStatsReport.ps1 | 58 ++++ .../Public/Get-ZAPlannerWanReport.ps1 | 52 ++++ .../Public/Get-ZAPlannerZcasReport.ps1 | 54 ++++ ZertoApiWrapper/Public/Get-ZAProtectedVm.ps1 | 51 ++++ .../Public/Get-ZAProtectedVmReport.ps1 | 32 ++ .../Public/Get-ZARPOAccountAverage.ps1 | 25 ++ ZertoApiWrapper/Public/Get-ZARPOAverage.ps1 | 31 ++ ZertoApiWrapper/Public/Get-ZARPOBreach.ps1 | 26 ++ ZertoApiWrapper/Public/Get-ZARPOStat.ps1 | 26 ++ .../Public/Get-ZARPOStatusProportion.ps1 | 26 ++ ZertoApiWrapper/Public/Get-ZARPOSummary.ps1 | 26 ++ ZertoApiWrapper/Public/Get-ZASite.ps1 | 18 ++ ZertoApiWrapper/Public/Get-ZASitePair.ps1 | 24 ++ ZertoApiWrapper/Public/Get-ZASiteTopology.ps1 | 20 ++ ZertoApiWrapper/Public/Get-ZATask.ps1 | 39 +++ ZertoApiWrapper/Public/Get-ZAVolume.ps1 | 44 +++ ZertoApiWrapper/Public/Get-ZAVpg.ps1 | 36 +++ ZertoApiWrapper/Public/Get-ZAzOrg.ps1 | 7 + ZertoApiWrapper/Public/Get-ZertoAlert.ps1 | 10 +- ZertoApiWrapper/Public/Get-ZertoEvent.ps1 | 14 +- ZertoApiWrapper/Public/Get-ZertoPeerSite.ps1 | 5 +- .../Public/Get-ZertoProtectedVm.ps1 | 2 +- .../Public/Get-ZertoRecoveryReport.ps1 | 6 - .../Public/Get-ZertoUnprotectedVm.ps1 | 2 +- .../Public/Get-ZertoVirtualizationSite.ps1 | 76 ++--- ZertoApiWrapper/Public/Get-ZertoVpg.ps1 | 52 ++-- .../Public/Get-ZertoVpgSetting.ps1 | 108 ++++--- .../Public/Import-ZertoVmNicSetting.ps1 | 124 ++++++++ ZertoApiWrapper/Public/Import-ZertoVpg.ps1 | 2 +- ZertoApiWrapper/Public/Install-ZertoVra.ps1 | 195 +++++++++---- .../Public/Invoke-ZARestRequest.ps1 | 48 +++ .../Public/Invoke-ZertoEvacuateVra.ps1 | 62 ++++ .../Public/Invoke-ZertoFailover.ps1 | 6 +- .../Public/Invoke-ZertoFailoverCommit.ps1 | 2 +- .../Public/Invoke-ZertoFailoverRollback.ps1 | 2 +- .../Public/Invoke-ZertoForceSync.ps1 | 2 +- ZertoApiWrapper/Public/Invoke-ZertoMove.ps1 | 123 +++++--- .../Public/Invoke-ZertoMoveCommit.ps1 | 29 +- .../Public/Invoke-ZertoMoveRollback.ps1 | 2 +- .../Public/Invoke-ZertoRestRequest.ps1 | 110 +++++++ .../Public/New-ZertoPairingToken.ps1 | 23 ++ ZertoApiWrapper/Public/New-ZertoVpg.ps1 | 95 +++--- .../Public/New-ZertoVpgSettingsIdentifier.ps1 | 4 +- .../Public/Remove-ZertoPeerSite.ps1 | 12 +- ZertoApiWrapper/Public/Remove-ZertoVpg.ps1 | 6 +- .../Remove-ZertoVpgSettingsIdentifier.ps1 | 26 ++ ZertoApiWrapper/Public/Remove-ZertoVpgVm.ps1 | 53 ++++ ZertoApiWrapper/Public/Resume-ZertoVpg.ps1 | 2 +- .../Public/Save-ZertoVpgSetting.ps1 | 18 +- ZertoApiWrapper/Public/Set-ZertoAlert.ps1 | 6 +- ZertoApiWrapper/Public/Set-ZertoLicense.ps1 | 8 +- .../Public/Set-ZertoUserCredential.ps1 | 35 +++ .../Public/Start-ZertoCloneVpg.ps1 | 33 +-- .../Public/Start-ZertoFailoverTest.ps1 | 7 +- ZertoApiWrapper/Public/Stop-ZertoCloneVpg.ps1 | 2 +- .../Public/Stop-ZertoFailoverTest.ps1 | 4 +- ZertoApiWrapper/Public/Suspend-ZertoVpg.ps1 | 2 +- ZertoApiWrapper/Public/Uninstall-ZertoVra.ps1 | 2 +- .../Public/en-us/ZertoApiWrapper-help.xml | 96 +++--- ZertoApiWrapper/ZertoApiWrapper.psd1 | 4 +- azure-pipelines.yml | 132 +++++---- build.ps1 | 7 +- docs/Add-ZertoPeerSite.md | 31 +- docs/Add-ZertoVpgVm.md | 138 +++++++++ docs/Checkpoint-ZertoVpg.md | 8 +- docs/Connect-ZertoAnalytics.md | 61 ++++ docs/Connect-ZertoServer.md | 245 +++++++++------- docs/Copy-ZertoVpg.md | 127 ++++++++ docs/Disconnect-ZertoServer.md | 2 +- docs/Edit-ZertoVra.md | 32 +- docs/Export-ZertoVmNicSetting.md | 79 +++++ docs/Export-ZertoVpg.md | 2 +- docs/Get-ZAAlert.md | 125 ++++++++ docs/Get-ZADatastore.md | 123 ++++++++ docs/Get-ZAEvent.md | 140 +++++++++ docs/Get-ZAJournalAverageHistory.md | 123 ++++++++ docs/Get-ZAJournalAverageSize.md | 123 ++++++++ docs/Get-ZAJournalBreach.md | 101 +++++++ docs/Get-ZAJournalHistoryStat.md | 101 +++++++ docs/Get-ZAJournalSiteAverageHistory.md | 123 ++++++++ docs/Get-ZAJournalSiteAverageSize.md | 123 ++++++++ docs/Get-ZAJournalSiteHistoryStat.md | 123 ++++++++ docs/Get-ZAJournalSiteHistorySummary.md | 123 ++++++++ docs/Get-ZAJournalSiteSizeStat.md | 123 ++++++++ docs/Get-ZAJournalStatusProportion.md | 101 +++++++ docs/Get-ZAJournalStorageStat.md | 101 +++++++ docs/Get-ZAJournalSummary.md | 101 +++++++ docs/Get-ZALicense.md | 45 +++ docs/Get-ZAMonitoring.md | 69 +++++ docs/Get-ZANetworkSiteAverageIOPS.md | 183 ++++++++++++ docs/Get-ZANetworkSiteAveragePerformance.md | 183 ++++++++++++ docs/Get-ZANetworkSiteStat.md | 167 +++++++++++ docs/Get-ZANetworkSiteSummary.md | 167 +++++++++++ docs/Get-ZANetworkVpgAverageIOPS.md | 109 +++++++ docs/Get-ZANetworkVpgAveragePerformance.md | 109 +++++++ docs/Get-ZANetworkVpgStat.md | 94 ++++++ docs/Get-ZANetworkVpgSummary.md | 94 ++++++ docs/Get-ZAPlannerJournalSizeReport.md | 163 +++++++++++ docs/Get-ZAPlannerNetworkPerformanceReport.md | 158 ++++++++++ docs/Get-ZAPlannerSite.md | 67 +++++ docs/Get-ZAPlannerStatsReport.md | 149 ++++++++++ docs/Get-ZAPlannerWanReport.md | 125 ++++++++ docs/Get-ZAPlannerZcasReport.md | 125 ++++++++ docs/Get-ZAProtectedVm.md | 120 ++++++++ docs/Get-ZAProtectedVmReport.md | 60 ++++ docs/Get-ZARPOAccountAverage.md | 109 +++++++ docs/Get-ZARPOAverage.md | 118 ++++++++ docs/Get-ZARPOBreach.md | 107 +++++++ docs/Get-ZARPOStat.md | 107 +++++++ docs/Get-ZARPOStatusProportion.md | 108 +++++++ docs/Get-ZARPOSummary.md | 107 +++++++ docs/Get-ZASite.md | 69 +++++ docs/Get-ZASitePair.md | 104 +++++++ docs/Get-ZASiteTopology.md | 70 +++++ docs/Get-ZATask.md | 112 +++++++ docs/Get-ZAVolume.md | 137 +++++++++ docs/Get-ZAVpg.md | 98 +++++++ docs/Get-ZAzOrg.md | 46 +++ docs/Get-ZertoAlert.md | 2 +- docs/Get-ZertoDatastore.md | 2 +- docs/Get-ZertoEvent.md | 21 +- docs/Get-ZertoLicense.md | 2 +- docs/Get-ZertoLocalSite.md | 2 +- docs/Get-ZertoPeerSite.md | 2 +- docs/Get-ZertoProtectedVm.md | 3 +- docs/Get-ZertoRecoveryReport.md | 21 +- docs/Get-ZertoResourcesReport.md | 2 +- docs/Get-ZertoServiceProfile.md | 2 +- docs/Get-ZertoTask.md | 3 +- docs/Get-ZertoUnprotectedVm.md | 2 +- docs/Get-ZertoVirtualizationSite.md | 26 +- docs/Get-ZertoVolume.md | 2 +- docs/Get-ZertoVpg.md | 3 +- docs/Get-ZertoVpgSetting.md | 47 ++- docs/Get-ZertoVra.md | 2 +- docs/Get-ZertoZorg.md | 2 +- docs/Get-ZertoZsspSession.md | 2 +- docs/Import-ZertoVmNicSetting.md | 96 ++++++ docs/Import-ZertoVpg.md | 2 +- docs/Install-ZertoVra.md | 68 ++++- docs/Invoke-ZARestRequest.md | 100 +++++++ docs/Invoke-ZertoEvacuateVra.md | 148 ++++++++++ docs/Invoke-ZertoFailover.md | 2 +- docs/Invoke-ZertoFailoverCommit.md | 34 ++- docs/Invoke-ZertoFailoverRollback.md | 2 +- docs/Invoke-ZertoForceSync.md | 2 +- docs/Invoke-ZertoMove.md | 89 ++++-- docs/Invoke-ZertoMoveCommit.md | 45 ++- docs/Invoke-ZertoMoveRollback.md | 2 +- docs/Invoke-ZertoRestRequest.md | 154 ++++++++++ docs/New-ZertoPairingToken.md | 78 +++++ docs/New-ZertoVpg.md | 26 +- docs/New-ZertoVpgSettingsIdentifier.md | 2 +- docs/Remove-ZertoPeerSite.md | 4 +- docs/Remove-ZertoVpg.md | 6 +- docs/Remove-ZertoVpgSettingsIdentifier.md | 90 ++++++ docs/Remove-ZertoVpgVm.md | 121 ++++++++ docs/Resume-ZertoVpg.md | 2 +- docs/Save-ZertoVpgSetting.md | 6 +- docs/Set-ZertoAlert.md | 2 +- docs/Set-ZertoLicense.md | 2 +- docs/Set-ZertoUserCredential.md | 97 ++++++ docs/Start-ZertoCloneVpg.md | 2 +- docs/Start-ZertoFailoverTest.md | 2 +- docs/Stop-ZertoCloneVpg.md | 2 +- docs/Stop-ZertoFailoverTest.md | 2 +- docs/Suspend-ZertoVpg.md | 2 +- docs/Uninstall-ZertoVra.md | 2 +- version.txt | 2 +- 359 files changed, 16198 insertions(+), 2254 deletions(-) create mode 100644 .github/CONTRIBUTING.md create mode 100644 .github/ISSUE_TEMPLATE.md create mode 100644 .github/PULL_REQUEST_TEMPLATE.md create mode 100644 CHANGELOG.md create mode 100644 CODE_OF_CONDUCT.md delete mode 100644 RELEASENOTES.md create mode 100644 Tests/Private/Get-Map.Tests.ps1 delete mode 100644 Tests/Private/Invoke-ZertoRestRequest.Tests.ps1 create mode 100644 Tests/Private/Mocks/ProtectedVMs.json create mode 100644 Tests/Public/Add-ZertoVpgVm.Tests.ps1 create mode 100644 Tests/Public/Connect-ZertoAnalytics.Tests.ps1 create mode 100644 Tests/Public/Copy-ZertoVpg.Tests.ps1 create mode 100644 Tests/Public/Export-ZertoVmNicSetting.Tests.ps1 create mode 100644 Tests/Public/Get-ZAAlert.Tests.ps1 create mode 100644 Tests/Public/Get-ZADatastore.Tests.ps1 create mode 100644 Tests/Public/Get-ZAEvent.Tests.ps1 create mode 100644 Tests/Public/Get-ZAJournalAverageHistory.Tests.ps1 create mode 100644 Tests/Public/Get-ZAJournalAverageSize.Tests.ps1 create mode 100644 Tests/Public/Get-ZAJournalBreach.Tests.ps1 create mode 100644 Tests/Public/Get-ZAJournalHistoryStat.Tests.ps1 create mode 100644 Tests/Public/Get-ZAJournalSiteAverageHistory.Tests.ps1 create mode 100644 Tests/Public/Get-ZAJournalSiteAverageSize.Tests.ps1 create mode 100644 Tests/Public/Get-ZAJournalSiteHistoryStat.Tests.ps1 create mode 100644 Tests/Public/Get-ZAJournalSiteHistorySummary.Tests.ps1 create mode 100644 Tests/Public/Get-ZAJournalSiteSizeStat.Tests.ps1 create mode 100644 Tests/Public/Get-ZAJournalStatusProportion.Tests.ps1 create mode 100644 Tests/Public/Get-ZAJournalStorageStat.Tests.ps1 create mode 100644 Tests/Public/Get-ZAJournalSummary.Tests.ps1 create mode 100644 Tests/Public/Get-ZALicense.Tests.ps1 create mode 100644 Tests/Public/Get-ZAMonitoring.Tests.ps1 create mode 100644 Tests/Public/Get-ZANetworkSiteAverageIOPS.Tests.ps1 create mode 100644 Tests/Public/Get-ZANetworkSiteAveragePerformance.Tests.ps1 create mode 100644 Tests/Public/Get-ZANetworkSiteStat.Tests.ps1 create mode 100644 Tests/Public/Get-ZANetworkSiteSummary.Tests.ps1 create mode 100644 Tests/Public/Get-ZANetworkVpgAverageIOPS.Tests.ps1 create mode 100644 Tests/Public/Get-ZANetworkVpgAveragePerformance.Tests.ps1 create mode 100644 Tests/Public/Get-ZANetworkVpgStat.Tests.ps1 create mode 100644 Tests/Public/Get-ZANetworkVpgSummary.Tests.ps1 create mode 100644 Tests/Public/Get-ZAPlannerJournalSizeReport.Tests.ps1 create mode 100644 Tests/Public/Get-ZAPlannerNetworkPerformanceReport.Tests.ps1 create mode 100644 Tests/Public/Get-ZAPlannerSite.Tests.ps1 create mode 100644 Tests/Public/Get-ZAPlannerStatsReport.Tests.ps1 create mode 100644 Tests/Public/Get-ZAPlannerWanReport.Tests.ps1 create mode 100644 Tests/Public/Get-ZAPlannerZcasReport.Tests.ps1 create mode 100644 Tests/Public/Get-ZAProtectedVm.Tests.ps1 create mode 100644 Tests/Public/Get-ZAProtectedVmReport.Tests.ps1 create mode 100644 Tests/Public/Get-ZARPOAccountAverage.Tests.ps1 create mode 100644 Tests/Public/Get-ZARPOAverage.Tests.ps1 create mode 100644 Tests/Public/Get-ZARPOBreach.Tests.ps1 create mode 100644 Tests/Public/Get-ZARPOStat.Tests.ps1 create mode 100644 Tests/Public/Get-ZARPOStatusProportion.Tests.ps1 create mode 100644 Tests/Public/Get-ZARPOSummary.Tests.ps1 create mode 100644 Tests/Public/Get-ZASite.Tests.ps1 create mode 100644 Tests/Public/Get-ZASitePair.Tests.ps1 create mode 100644 Tests/Public/Get-ZASiteTopology.Tests.ps1 create mode 100644 Tests/Public/Get-ZATask.Tests.ps1 create mode 100644 Tests/Public/Get-ZAVolume.Tests.ps1 create mode 100644 Tests/Public/Get-ZAVpg.Tests.ps1 create mode 100644 Tests/Public/Get-ZAzOrg.Tests.ps1 create mode 100644 Tests/Public/Import-ZertoVmNicSetting.Tests.ps1 create mode 100644 Tests/Public/Invoke-ZARestRequest.Tests.ps1 create mode 100644 Tests/Public/Invoke-ZertoEvacuateVra.Tests.ps1 create mode 100644 Tests/Public/Invoke-ZertoRestRequest.Tests.ps1 create mode 100644 Tests/Public/Mocks/AuthHeaders.json create mode 100644 Tests/Public/Mocks/CopyVpgSettings.json create mode 100644 Tests/Public/Mocks/GetDhcpVra.json create mode 100644 Tests/Public/Mocks/GetSingleVra.json create mode 100644 Tests/Public/Mocks/GetVpg.json create mode 100644 Tests/Public/Mocks/LocalSiteInfo.json create mode 100644 Tests/Public/Mocks/PairingToken.json create mode 100644 Tests/Public/Mocks/ProtectedVms.json create mode 100644 Tests/Public/Mocks/TaskId.txt create mode 100644 Tests/Public/Mocks/UnprotectedVms.json create mode 100644 Tests/Public/Mocks/VPGInfo.json create mode 100644 Tests/Public/Mocks/VirtualSite-Folders.json create mode 100644 Tests/Public/Mocks/VirtualSite-Networks.json create mode 100644 Tests/Public/Mocks/VirtualSite-NoParams.json create mode 100644 Tests/Public/Mocks/VirtualSite-ResourcePools.json create mode 100644 Tests/Public/Mocks/VirtualSite-SiteId.json create mode 100644 Tests/Public/Mocks/VirtualSite-VMs.json create mode 100644 Tests/Public/Mocks/VirtualSite-datastoreClusters.json create mode 100644 Tests/Public/Mocks/VirtualSite-datastores.json create mode 100644 Tests/Public/Mocks/VirtualSite-devices-hostid.json create mode 100644 Tests/Public/Mocks/VirtualSite-devices.json create mode 100644 Tests/Public/Mocks/VirtualSite-hostClusters.json create mode 100644 Tests/Public/Mocks/VirtualSite-hosts-hostid.json create mode 100644 Tests/Public/Mocks/VirtualSite-hosts.json create mode 100644 Tests/Public/Mocks/VirtualSite-repositories.json create mode 100644 Tests/Public/Mocks/VpgId.txt create mode 100644 Tests/Public/Mocks/ZAToken.json create mode 100644 Tests/Public/New-ZertoPairingToken.Tests.ps1 create mode 100644 Tests/Public/Remove-ZertoVpgSettingsIdentifier.Tests.ps1 create mode 100644 Tests/Public/Remove-ZertoVpgVm.Tests.ps1 create mode 100644 Tests/Public/Set-ZertoUserCredential.Tests.ps1 create mode 100644 ZertoApiWrapper/Private/Get-Map.ps1 delete mode 100644 ZertoApiWrapper/Private/Invoke-ZertoRestRequest.ps1 create mode 100644 ZertoApiWrapper/Public/Add-ZertoVpgVm.ps1 create mode 100644 ZertoApiWrapper/Public/Connect-ZertoAnalytics.ps1 create mode 100644 ZertoApiWrapper/Public/Copy-ZertoVpg.ps1 create mode 100644 ZertoApiWrapper/Public/Export-ZertoVmNicSetting.ps1 create mode 100644 ZertoApiWrapper/Public/Get-ZAAlert.ps1 create mode 100644 ZertoApiWrapper/Public/Get-ZADatastore.ps1 create mode 100644 ZertoApiWrapper/Public/Get-ZAEvent.ps1 create mode 100644 ZertoApiWrapper/Public/Get-ZAJournalAverageHistory.ps1 create mode 100644 ZertoApiWrapper/Public/Get-ZAJournalAverageSize.ps1 create mode 100644 ZertoApiWrapper/Public/Get-ZAJournalBreach.ps1 create mode 100644 ZertoApiWrapper/Public/Get-ZAJournalHistoryStat.ps1 create mode 100644 ZertoApiWrapper/Public/Get-ZAJournalSiteAverageHistory.ps1 create mode 100644 ZertoApiWrapper/Public/Get-ZAJournalSiteAverageSize.ps1 create mode 100644 ZertoApiWrapper/Public/Get-ZAJournalSiteHistoryStat.ps1 create mode 100644 ZertoApiWrapper/Public/Get-ZAJournalSiteHistorySummary.ps1 create mode 100644 ZertoApiWrapper/Public/Get-ZAJournalSiteSizeStat.ps1 create mode 100644 ZertoApiWrapper/Public/Get-ZAJournalStatusProportion.ps1 create mode 100644 ZertoApiWrapper/Public/Get-ZAJournalStorageStat.ps1 create mode 100644 ZertoApiWrapper/Public/Get-ZAJournalSummary.ps1 create mode 100644 ZertoApiWrapper/Public/Get-ZALicense.ps1 create mode 100644 ZertoApiWrapper/Public/Get-ZAMonitoring.ps1 create mode 100644 ZertoApiWrapper/Public/Get-ZANetworkSiteAverageIOPS.ps1 create mode 100644 ZertoApiWrapper/Public/Get-ZANetworkSiteAveragePerformance.ps1 create mode 100644 ZertoApiWrapper/Public/Get-ZANetworkSiteStat.ps1 create mode 100644 ZertoApiWrapper/Public/Get-ZANetworkSiteSummary.ps1 create mode 100644 ZertoApiWrapper/Public/Get-ZANetworkVpgAverageIOPS.ps1 create mode 100644 ZertoApiWrapper/Public/Get-ZANetworkVpgAveragePerformance.ps1 create mode 100644 ZertoApiWrapper/Public/Get-ZANetworkVpgStat.ps1 create mode 100644 ZertoApiWrapper/Public/Get-ZANetworkVpgSummary.ps1 create mode 100644 ZertoApiWrapper/Public/Get-ZAPlannerJournalSizeReport.ps1 create mode 100644 ZertoApiWrapper/Public/Get-ZAPlannerNetworkPerformanceReport.ps1 create mode 100644 ZertoApiWrapper/Public/Get-ZAPlannerSite.ps1 create mode 100644 ZertoApiWrapper/Public/Get-ZAPlannerStatsReport.ps1 create mode 100644 ZertoApiWrapper/Public/Get-ZAPlannerWanReport.ps1 create mode 100644 ZertoApiWrapper/Public/Get-ZAPlannerZcasReport.ps1 create mode 100644 ZertoApiWrapper/Public/Get-ZAProtectedVm.ps1 create mode 100644 ZertoApiWrapper/Public/Get-ZAProtectedVmReport.ps1 create mode 100644 ZertoApiWrapper/Public/Get-ZARPOAccountAverage.ps1 create mode 100644 ZertoApiWrapper/Public/Get-ZARPOAverage.ps1 create mode 100644 ZertoApiWrapper/Public/Get-ZARPOBreach.ps1 create mode 100644 ZertoApiWrapper/Public/Get-ZARPOStat.ps1 create mode 100644 ZertoApiWrapper/Public/Get-ZARPOStatusProportion.ps1 create mode 100644 ZertoApiWrapper/Public/Get-ZARPOSummary.ps1 create mode 100644 ZertoApiWrapper/Public/Get-ZASite.ps1 create mode 100644 ZertoApiWrapper/Public/Get-ZASitePair.ps1 create mode 100644 ZertoApiWrapper/Public/Get-ZASiteTopology.ps1 create mode 100644 ZertoApiWrapper/Public/Get-ZATask.ps1 create mode 100644 ZertoApiWrapper/Public/Get-ZAVolume.ps1 create mode 100644 ZertoApiWrapper/Public/Get-ZAVpg.ps1 create mode 100644 ZertoApiWrapper/Public/Get-ZAzOrg.ps1 create mode 100644 ZertoApiWrapper/Public/Import-ZertoVmNicSetting.ps1 create mode 100644 ZertoApiWrapper/Public/Invoke-ZARestRequest.ps1 create mode 100644 ZertoApiWrapper/Public/Invoke-ZertoEvacuateVra.ps1 create mode 100644 ZertoApiWrapper/Public/Invoke-ZertoRestRequest.ps1 create mode 100644 ZertoApiWrapper/Public/New-ZertoPairingToken.ps1 create mode 100644 ZertoApiWrapper/Public/Remove-ZertoVpgSettingsIdentifier.ps1 create mode 100644 ZertoApiWrapper/Public/Remove-ZertoVpgVm.ps1 create mode 100644 ZertoApiWrapper/Public/Set-ZertoUserCredential.ps1 create mode 100644 docs/Add-ZertoVpgVm.md create mode 100644 docs/Connect-ZertoAnalytics.md create mode 100644 docs/Copy-ZertoVpg.md create mode 100644 docs/Export-ZertoVmNicSetting.md create mode 100644 docs/Get-ZAAlert.md create mode 100644 docs/Get-ZADatastore.md create mode 100644 docs/Get-ZAEvent.md create mode 100644 docs/Get-ZAJournalAverageHistory.md create mode 100644 docs/Get-ZAJournalAverageSize.md create mode 100644 docs/Get-ZAJournalBreach.md create mode 100644 docs/Get-ZAJournalHistoryStat.md create mode 100644 docs/Get-ZAJournalSiteAverageHistory.md create mode 100644 docs/Get-ZAJournalSiteAverageSize.md create mode 100644 docs/Get-ZAJournalSiteHistoryStat.md create mode 100644 docs/Get-ZAJournalSiteHistorySummary.md create mode 100644 docs/Get-ZAJournalSiteSizeStat.md create mode 100644 docs/Get-ZAJournalStatusProportion.md create mode 100644 docs/Get-ZAJournalStorageStat.md create mode 100644 docs/Get-ZAJournalSummary.md create mode 100644 docs/Get-ZALicense.md create mode 100644 docs/Get-ZAMonitoring.md create mode 100644 docs/Get-ZANetworkSiteAverageIOPS.md create mode 100644 docs/Get-ZANetworkSiteAveragePerformance.md create mode 100644 docs/Get-ZANetworkSiteStat.md create mode 100644 docs/Get-ZANetworkSiteSummary.md create mode 100644 docs/Get-ZANetworkVpgAverageIOPS.md create mode 100644 docs/Get-ZANetworkVpgAveragePerformance.md create mode 100644 docs/Get-ZANetworkVpgStat.md create mode 100644 docs/Get-ZANetworkVpgSummary.md create mode 100644 docs/Get-ZAPlannerJournalSizeReport.md create mode 100644 docs/Get-ZAPlannerNetworkPerformanceReport.md create mode 100644 docs/Get-ZAPlannerSite.md create mode 100644 docs/Get-ZAPlannerStatsReport.md create mode 100644 docs/Get-ZAPlannerWanReport.md create mode 100644 docs/Get-ZAPlannerZcasReport.md create mode 100644 docs/Get-ZAProtectedVm.md create mode 100644 docs/Get-ZAProtectedVmReport.md create mode 100644 docs/Get-ZARPOAccountAverage.md create mode 100644 docs/Get-ZARPOAverage.md create mode 100644 docs/Get-ZARPOBreach.md create mode 100644 docs/Get-ZARPOStat.md create mode 100644 docs/Get-ZARPOStatusProportion.md create mode 100644 docs/Get-ZARPOSummary.md create mode 100644 docs/Get-ZASite.md create mode 100644 docs/Get-ZASitePair.md create mode 100644 docs/Get-ZASiteTopology.md create mode 100644 docs/Get-ZATask.md create mode 100644 docs/Get-ZAVolume.md create mode 100644 docs/Get-ZAVpg.md create mode 100644 docs/Get-ZAzOrg.md create mode 100644 docs/Import-ZertoVmNicSetting.md create mode 100644 docs/Invoke-ZARestRequest.md create mode 100644 docs/Invoke-ZertoEvacuateVra.md create mode 100644 docs/Invoke-ZertoRestRequest.md create mode 100644 docs/New-ZertoPairingToken.md create mode 100644 docs/Remove-ZertoVpgSettingsIdentifier.md create mode 100644 docs/Remove-ZertoVpgVm.md create mode 100644 docs/Set-ZertoUserCredential.md diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md new file mode 100644 index 0000000..4006efc --- /dev/null +++ b/.github/CONTRIBUTING.md @@ -0,0 +1,62 @@ +# How to contribute + +Contributions to ZertoApiWrapper are highly encouraged and desired. +Below are some guidelines that will help make the process as smooth as possible. + +## Getting Started + +- Make sure you have a [GitHub account](https://github.com/signup/free) +- Submit a new issue, assuming one does not already exist. + - Clearly describe the issue including steps to reproduce when it is a bug. + - Make sure you fill in the earliest version that you know has the issue. +- Fork the repository on GitHub + +## Suggesting Enhancements + +I want to know what you think is missing from ZertoApiWrapper and how it can be made better. + +- When submitting an issue for an enhancement, please be as clear as possible about why you think the enhancement is needed and what the benefit of it would be. + +## Making Changes + +- From your fork of the repository, create a topic branch where work on your change will take place. +- To quickly create a topic branch based on master; `git checkout -b my_contribution master`. + Please avoid working directly on the `master` branch. +- Make commits of logical units. +- Check for unnecessary whitespace with `git diff --check` before committing. +- Please follow the prevailing code conventions in the repository. + Differences in style make the code harder to understand for everyone. +- Make sure your commit messages are in the proper format. + +``` + Add more cowbell to Get-Something.ps1 + + The functionality of Get-Something would be greatly improved if there was a little + more 'pizzazz' added to it. I propose a cowbell. Adding more cowbell has been + shown in studies to both increase one's mojo, and cement one's status + as a rock legend. +``` + +- Make sure you have added all the necessary Pester tests for your changes. +- Run _all_ Pester tests in the module to assure nothing else was accidentally broken. + +## Documentation + +I am infallible and as such my documenation needs no corectoin. +In the highly unlikely event that that is _not_ the case, commits to update or add documentation are highly apprecaited. + +## Submitting Changes + +- Push your changes to a topic branch in your fork of the repository. +- Submit a pull request to the main repository. +- Once the pull request has been reviewed and accepted, it will be merged with the master branch. +- Celebrate + +## Additional Resources + +- [General GitHub documentation](https://help.github.com/) +- [GitHub forking documentation](https://guides.github.com/activities/forking/) +- [GitHub pull request documentation](https://help.github.com/send-pull-requests/) +- [GitHub Flow guide](https://guides.github.com/introduction/flow/) +- [GitHub's guide to contributing to open source projects](https://guides.github.com/activities/contributing-to-open-source/) + diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md new file mode 100644 index 0000000..28202e0 --- /dev/null +++ b/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,31 @@ + + +## Expected Behavior + + + +## Current Behavior + + + +## Possible Solution + + + +## Steps to Reproduce (for bugs) + + +1. +2. +3. +4. + +## Context + + + +## Your Environment + +* Module version used: +* Operating System and PowerShell version: +* Zerto Virtual Manager Version: diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..52edb2a --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,37 @@ + + +## Description + + +## Related Issue + + + + + +## Motivation and Context + + +## How Has This Been Tested? + + + + +## Screenshots (if appropriate): + +## Types of changes + +- [ ] Bug fix (non-breaking change which fixes an issue) +- [ ] New feature (non-breaking change which adds functionality) +- [ ] Breaking change (fix or feature that would cause existing functionality to change) + +## Checklist: + + +- [ ] My code follows the code style of this project. +- [ ] My change requires a change to the documentation. +- [ ] I have updated the documentation accordingly. +- [ ] I have read the **CONTRIBUTING** document. +- [ ] I have added tests to cover my changes. +- [ ] All new and existing tests passed. + diff --git a/.gitignore b/.gitignore index 2f58130..614cba9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,9 @@ *.zip temp/* -Tests/Public/TestResults.xml -Tests/TestResults.xml +BuiltTestResults.xml +SourceTestResults.xml publish/* CodeCoverage.xml +scratch +.DS_Store diff --git a/.vscode/settings.json b/.vscode/settings.json index d6dea32..1b91392 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,4 +1,9 @@ { "files.trimTrailingWhitespace": true, - "terminal.integrated.shell.windows": "c:/Program Files/PowerShell/6/pwsh.exe" + "files.insertFinalNewline": true, + "editor.insertSpaces": true, + "editor.tabSize": 4, + "powershell.codeFormatting.preset": "OTBS", + "terminal.integrated.shell.windows": "c:/Program Files/PowerShell/7/pwsh.exe", + "powershell.codeFormatting.addWhitespaceAroundPipe": true } diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..1ff98e1 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,159 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project is transitioning to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [1.5.3] + +### Zerto Virtual Manager + +#### Fixed + +* Fixed an [issue](https://github.com/ZertoPublic/ZertoApiWrapper/issues/112) where `New-ZertoVpg` would fail when specifying the local site as the target site. +* Updated the method where a Site Identifer is obtained during the `New-ZertoVpg` execution that would occasionally fail on some versions of PowerShell. + +#### Updated + +* Updated `New-ZertoVpg` function [help documentation](https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/New-ZertoVpg.md) to more clearly specify the return value and the requirement to pass it into the `Save-ZertoVpgSetting` function to commit the VPG. + +## [1.5.2] + +### Zerto Virtual Manager + +#### Fixed + +* Fixed an issue when attempting to export more than 100 VPGs with the `Export-ZertoVpg` function that would cause an error. + +## [1.5.1] + +### Zerto Virtual Manager + +#### Fixed + +* Fixed an [issue](https://github.com/ZertoPublic/ZertoApiWrapper/issues/108) with `New-ZertoVpg` where when specifying a single host as a recovery target, the host identifier was not properly assigned. - Thanks @jonsouzerto! +* Fixed an [issue](https://github.com/ZertoPublic/ZertoApiWrapper/issues/86) with `Invoke-ZertoMoveVpg` where parameters should have been mandatory in certain workflows. - Thanks @gdbarron! + +## [1.5.0] + +### Zerto Virtual Manager + +#### New + +* Added `Add-ZertoVpgVm` function to the module. Read the [help file](https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Add-ZertoVpgVm.md) for more information. +* Added `Remove-ZertoVpgVm` function to the module. Read the [help file](https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Remove-ZertoVpgVm.md) for more information. + +#### Fixed + +* Fixed an [issue](https://github.com/ZertoPublic/ZertoApiWrapper/issues/103) with `Add-ZertoPeerSite` where there was an incorrect settings validator on the `-targetHost` parameter where it would not accept a hostname. + +## [1.4.3] + +### Zerto Virtual Manager + +#### Updated + +* Updated `Connect-ZertoServer` with a `-AutoReconnect` switch to allow the auto reconnection of a session that has timed-out. +* Updated `New-ZertoVpg` to have a Default Parameter Set of `recoveryHostDatastore` should no parameters be passed when calling the function. +* Updated `New-ZertoVpg -recoverySite` parameter to be case-insensitive + +#### Fixed + +* Fixed an [issue](https://github.com/ZertoPublic/ZertoApiWrapper/issues/96) with `Set-ZertoLicense` so that ShouldProcess functions properly. +* Fixed an [issue](https://github.com/ZertoPublic/ZertoApiWrapper/issues/95) when attempting to connect to an unlicensed site. + +## [1.4.2] + +### Zerto Virtual Manager + +#### Fixed + +* Updated `Get-ZertoEvent` to translate a vpg name parameter to a vpgIdentifier per the API documentation +* Updated `Invoke-ZertoMoveCommit` to ensure that when one of the parameter switches is defined, all required parameters are sent to avoid conflicts with parameters passed with the `Invoke-ZertoMove` command. +* Updated `Start-ZertoCloneVpg` to fix an issue where an error would be thrown if an operation specified a subset of VMs to be cloned. + +## [1.4.1] + +### General + +* Removed RELEASENOTES and converted to a CHANGELOG format. +* Updated the build process to follow Semantic Versioning. +* Updated the build process to use the latest Pester Version (4.10.1) +* Updated the build process to use the latest PS Script Analyzer Version (1.19.0) +* Updated the Tests Files to use a more modern method of grabbing the PSScriptPath + +### Zerto Virtual Manager + +* Refactored `Copy-ZertoVpg` functionality to leverage identifier and name maps and eliminate `where-object` searches. +* Updated `Get-ZertoEvent` parameter to fall in line with the filter parameter name in the API documentation. Moved the old parameter name to an alias to ensure that existing functionality continues to work. + +## [1.4.0.20200410] + +### Zerto Virtual Manager + +* Addressed a reported [issue](https://github.com/ZertoPublic/ZertoApiWrapper/issues/60) in the `Get-ZertoRecoveryReport` function where the `-VpgIdentifier` parameter was not working. This parameter is not accepted by the API as a valid filter and is ignored. This parameter has been removed from the function. +* Addressed a reported [issue](https://github.com/ZertoPublic/ZertoApiWrapper/issues/61) where the `Export-ZertoVpgNicSetting` function would not properly execute when run against a VM with no NICs attached. +* In reviewing the `Export-ZertoVpgNicSetting`, a review of the `Import-ZertoVpgNicSetting` was completed and it was determined to update the import logic based on various test cases. Along with this, it is now possible to reset the NIC settings to the default state with the `Import-ZertoVpgNicSetting` command. Please review the [Import-ZertoVpgNicSetting help](https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Import-ZertoVmNicSetting.md) to review the updated options and import logic. +* Refactored the `Checkpoint-ZertoVpg` command to allow pipeline input (ByValue and ByProperty) for the VpgName parameter. +* Corrected a parameter typo in the `Get-ZertoVpgSetting` function. The misspelt parameter was added as an alias to ensure any existing scripts using the parameter continue to function. +* Refactored the `Get-ZertoVpg` command to remove repetitive commands and variables that are no longer required. +* Moved `Invoke-ZertoRestRequest` and `Invoke-ZARestRequest` to be public functions. As there become more and more scenarios where there are not prebuilt functions to accomplish complex specialized tasks, it became apparent that these functions could be leveraged to make the experience and workflow easier. +* Updated the `Install-ZertoVra` logic to ensure that the target datastore is available on the target host. There isn't currently any method to validate the target network, but if that becomes available in a later version of the API, the function will be updated. +* Updated the `Install-ZertoVra` function to allow for installation of the VRA using the host password method. Please review the [Install-ZertoVra](https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Install-ZertoVra.md) documentation for syntax and examples. +* Updated the `Edit-ZertoVra` function to allow for modification of the associated ESX host password if the need arises. Please review the [Edit-ZertoVra](https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Edit-ZertoVra.md) documentation for syntax and examples. +* Added a new function, `Set-ZertoUserCredential`, to allow the updating of the username and password used to connect the Zerto Virtual Manager to the paired hypervisor. Please see the [Set-ZertoUserCredential](https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Set-ZertoUserCredential.md) help for additional information. +* With the release of [Zerto 8.0](https://www.zerto.com/zerto-8-0-general-availability/) some additional API endpoints have become available. + * Updated `Get-ZertoVirtualizationSite` to add the `-repository` parameter to enable returning information for LTR repositories. + * Updated `Get-ZertoVpgSetting` to add the `-ltr` parameter to enable returning information for current LTR settings for the selected VPG. + +### Zerto Analytics + +* Added several functions for the newly added [Zerto Analytics](https://analytics.zerto.com) Planner. + * `Get-ZAPlannerSite` Help can be found here: [Get-ZAPlannerSite](https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZAPlannerSite.md) + * `Get-ZAPlannerStatsReport` Help can be found here: [Get-ZAPlannerStatsReport](https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZAPlannerStatsReport.md) + * `Get-ZAPlannerJournalSizeReport` Help can be found here: [Get-ZAPlannerJournalSizeReport](https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZAPlannerJournalSizeReport.md) + * `Get-ZAPlannerNetworkPerformanceReport` Help can be found here: [Get-ZAPlannerNetworkPerformanceReport](https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZAPlannerNetworkPerformanceReport.md) + * `Get-ZAPlannerWanReport` Help can be found here: [Get-ZAPlannerWanReport](https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZAPlannerWanReport.md) + * `Get-ZAPlannerZcasReport` Help can be found here: [Get-ZAPlannerZcasReport](https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZAPlannerZcasReport.md) +* Created `Get-ZAProtectedVm` and `Get-ZAProtectedVmReport` functions to leverage the newly released Zerto Analytics APIs for this data. Help files can be found here: [Get-ZAProtectedVm](https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZAProtectedVm.md) and [Get-ZAProtectedVmReport](https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZAProtectedVmReport.md) + +## [1.3.0.20191201] + +### Zerto Virtual Manager + +* [Zerto version 7.5 has been released.](https://s3.amazonaws.com/zertodownload_docs/Latest/Zerto%20Virtual%20Replication%20Release%20Notes.pdf) As part of this release Zerto has added API functionality that requires the following updates. + * A token is now required to pair two sites together. The need is discussed in [Issue 46](https://github.com/ZertoPublic/ZertoApiWrapper/issues/46). To implement this change a `-token` parameter has been added to the `Add-ZertoPeerSite` function. + * A new function has been added; `New-ZertoPairingToken`. This function will allow users to generate a pairing authentication token from the target ZVM to be used in the pairing process. [Issue 47](https://github.com/ZertoPublic/ZertoApiWrapper/issues/47) covers additional details. +* A new function has been added; `Invoke-ZertoEvacuateVra`. This function will allow users to evacuate a target VRA by specifying a Host Name, VRA Name, or VRA Identifier. All VMs currently replicating to the specified location will be migrated to different targets. [Issue 51](https://github.com/ZertoPublic/ZertoApiWrapper/issues/51) +* A function has been added; `Copy-ZertoVpg`. This function will allow users to copy the settings of a single VPG and add new VMs to it. There is currently no customization beyond specifying the VMs to be placed in the newly created VPG. Should additional edits \ updates be required, they should be done post creation. [Issue 54](https://github.com/ZertoPublic/ZertoApiWrapper/issues/54) +* Fixed [issue 57](https://github.com/ZertoPublic/ZertoApiWrapper/issues/57) where a `Start-ZertoFailoverTest` would throw an error complaining about validating the body parameter. This has been fixed and tested against Zerto Virtual Manager 7.5 Update 1 with Windows PowerShell 5.1 and PowerShell Core 6.2. + +## [1.2.0.20190801] + +### Zerto Virtual Manager + +* Added two functions to aid in bulk updating of NIC information for protected VMs. ([Issue 38](https://github.com/ZertoPublic/ZertoApiWrapper/issues/38)) + * [Export-ZertoVmNicSetting](https://github.com/ZertoPublic/ZertoApiWrapper/blob/Master/docs/Export-ZertoVmNicSettings.md) + * [Import-ZertoVmNicSetting](https://github.com/ZertoPublic/ZertoApiWrapper/blob/Master/docs/Import-ZertoVmNicSettings.md) +* Fixed an [issue](https://github.com/ZertoPublic/ZertoApiWrapper/issues/43) where a VPG being created with a single VM member would not be parsed by the API correctly using PowerShell 5.1 + +### Zerto Analytics + +* Fixed an [issue](https://github.com/ZertoPublic/ZertoApiWrapper/issues/36) where the Zerto Analytics Rest Request function was not checking for the token before attempting a connection. +* Fixed an [issue](https://github.com/ZertoPublic/ZertoApiWrapper/issues/40) where the `Get-ZAVpg` method would return a 404 error when a `-vpgIdentifier` parameter was specified. + +### General Updates + +* Updated the way that tests are invoked and parsed to ensure that both source and built module files are tested. This will ensure that what is being shipped passes all tests along with testing of the source files. +* Added additional parameter validation tests to several of the functions. On-going effort to complete stand alone unit testing of each function. + +## [Initial Release] + +### Zerto Virtual Manager + +* Updated `Invoke-ZertoRestRequest` to work in Powershell 5.1 as well as Powershell core + +### Zerto Analytics + +* Implemented Zerto Analytics Functionality. Please see [Getting Started with Zerto Analytics](https://github.com/ZertoPublic/ZertoApiWrapper/wiki/Getting-Started-with-Zerto-Analytics) diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..c79c49d --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,76 @@ +# Code of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as +contributors and maintainers pledge to making participation in our project and +our community a harassment-free experience for everyone, regardless of age, body +size, disability, ethnicity, sex characteristics, gender identity and expression, +level of experience, education, socio-economic status, nationality, personal +appearance, race, religion, or sexual identity and orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment +include: + +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery and unwelcome sexual attention or + advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or electronic + address, without explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable +behavior and are expected to take appropriate and fair corrective action in +response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or +reject comments, commits, code, wiki edits, issues, and other contributions +that are not aligned to this Code of Conduct, or to ban temporarily or +permanently any contributor for other behaviors that they deem inappropriate, +threatening, offensive, or harmful. + +## Scope + +This Code of Conduct applies both within project spaces and in public spaces +when an individual is representing the project or its community. Examples of +representing a project or community include using an official project e-mail +address, posting via an official social media account, or acting as an appointed +representative at an online or offline event. Representation of a project may be +further defined and clarified by project maintainers. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported by contacting the project team at technicalmarketing@zerto.com. All +complaints will be reviewed and investigated and will result in a response that +is deemed necessary and appropriate to the circumstances. The project team is +obligated to maintain confidentiality with regard to the reporter of an incident. +Further details of specific enforcement policies may be posted separately. + +Project maintainers who do not follow or enforce the Code of Conduct in good +faith may face temporary or permanent repercussions as determined by other +members of the project's leadership. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, +available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html + +[homepage]: https://www.contributor-covenant.org + +For answers to common questions about this code of conduct, see +https://www.contributor-covenant.org/faq diff --git a/README.md b/README.md index 0fa3a9a..65b5674 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,11 @@ # ZertoApiWrapper -PowerShell Core wrapper for Zerto Virtual Manager API +PowerShell wrapper for Zerto Virtual Manager API ## Current Build Status -[![Codacy Badge](https://api.codacy.com/project/badge/Grade/0e31e5cdad534271ac688a82cc3ca17d)](https://app.codacy.com/app/wcarroll/ZertoApiWrapper?utm_source=github.com&utm_medium=referral&utm_content=wcarroll/ZertoApiWrapper&utm_campaign=Badge_Grade_Settings) -[![Build Status](https://dev.azure.com/wescarroll/ZertoApiWrapper/_apis/build/status/wcarroll.ZertoApiWrapper?branchName=master)](https://dev.azure.com/wescarroll/ZertoApiWrapper/_build/latest?definitionId=1&branchName=master) +[![Build Status](https://dev.azure.com/ZertoPublic/ZertoApiWrapper/_apis/build/status/ZertoPublic.ZertoApiWrapper?branchName=master)](https://dev.azure.com/ZertoPublic/ZertoApiWrapper/_build/latest?definitionId=1&branchName=master) +[![PowerShell Gallery](https://img.shields.io/powershellgallery/dt/ZertoApiWrapper?label=PowerShell%20Gallery%20Downloads)](https://www.powershellgallery.com/packages/ZertoApiWrapper) ## Legal Disclaimer @@ -15,54 +15,30 @@ In no event shall Zerto, its authors or anyone else involved in the creation, pr ## Disclaimer -This code is still under development!! USE AT YOUR OWN RISK AND ONLY IF YOU KNOW WHAT YOU ARE DOING!! +This code is still under development! Please use carefully and if you encounter any issues or have an idea, please submit an [issue](https://github.com/ZertoPublic/ZertoApiWrapper/issues). Along the same lines, should you be proficient in PowerShell, please feel free to submit any [Pull Requests](https://github.com/ZertoPublic/ZertoApiWrapper/pulls) with enhancements and bug fixes. -## Getting Started - -Place the folder and contents on your hard drive in a location known to you. From there run the following command to import the module into your session: - -```PowerShell -PS C:\>Import-Module \ZertoApiWrapper\ZertoApiWrapper\ZertoApiWrapper.psm1 -force -``` - -This will import the module into your current session and make the function available to you use and test. +## Installing the Module -### Connecting to a ZVM - -Before any of the functions will work, you will need to connect to a Zerto Virtual Manager server. To do this you will use the `Connect-ZertoServer` function passing in a Server Name or IP address of the Zerto Virtual Manager. If you are using a non-standard port, you will need to provide that as well with the `-zertoPort` parameter. You will also need to supply credentials to authenticate against the Zerto Virtual Manager. If credentials are not provided, the user will be prompted for a username and password. +This module can be installed directly from the [PowerShell Gallery](https://www.powershellgallery.com/packages/ZertoApiWrapper) with the following command. ```PowerShell -PS C:\>$credential = Get-Credential -PS C:\>Connect-ZertoServer -zertoServer "192.168.222.20" -credential $credential +PS> Install-Module -name ZertoApiWrapper ``` -After successful execution, a few Module level variables are set that are not currently exposed. These variables keep track of the Zerto Server connection information such as Server Name and Port information along with the authentication headers. A "Last Action" variable is also set to keep track of when the last call was made to the API to determine if the authentication information has expired or not. Should this command be run again with a different server, the old information will be overwritten and all commands from that point will be executed against the new server information. - -### Using the Module - -A help system is currently under development. While each command has a help page, it may not be fully fleshed out yet. To see all possible functions you can use the following command after the module has been imported: - -```PowerShell -PS C:\>Get-Command -module ZertoApiWrapper -``` - -Once you have found the command that you want to know about you can call `Get-Help ` to take a look at the help page, or if you want to see syntax, `Get-Command -syntax`. - -### Ending the Session +## Getting Started -If you are using this as part of a larger script, I highly suggest explicitly ending your session with the `Disconnect-ZertoSession` command. This will delete the token authorization from the Zerto Virtual Manager as well as clear all Module scoped variables. +* [Getting Started with Zerto Virtual Manager and the ZertoApiWrapper](https://github.com/ZertoPublic/ZertoApiWrapper/wiki/Getting-Started-with-Zerto-Virtual-Manager) +* [Getting Started with Zerto Analytics and the ZertoApiWrapper](https://github.com/ZertoPublic/ZertoApiWrapper/wiki/Getting-Started-with-Zerto-Analytics) ## Recent Updates -- March 15th, 2019: Implement Export and Import Functionality. Please See [Export-ZertoVpg Help](https://github.com/wcarroll/ZertoApiWrapper/blob/master/docs/Export-ZertoVpg.md) and [Import-ZertoVpg Help](https://github.com/wcarroll/ZertoApiWrapper/blob/master/docs/Import-ZertoVpg.md) for assistance. No current pre-seed support. -- March 11th, 2019: Create basic VPG completed. Please see [New-ZertoVpg Help](https://github.com/wcarroll/ZertoApiWrapper/blob/master/docs/New-ZertoVpg.md) +All recent updates can now be tracked via the [Change Log](https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/CHANGELOG.md). ## TODO -- Complete Help Markdown Files -- JFLR Functionality -- Create VPG (Per-VM modification and Backup Settings) -- Edit VPG -- Delete Zerto License -- Flesh out Pester Tests -- Complete Automated Build Process +* JFLR Functionality +* Create VPG (Per-VM modification and Backup Settings) +* Edit VPG +* Delete Zerto License +* Flesh out Pester Tests +* Complete Automated Build Process diff --git a/RELEASENOTES.md b/RELEASENOTES.md deleted file mode 100644 index cfd8e79..0000000 --- a/RELEASENOTES.md +++ /dev/null @@ -1,6 +0,0 @@ - - -* New Feature 1 -* New Feature 2 - * New SubFeature 1 -* What is happening??? diff --git a/Tests/Private/Get-Map.Tests.ps1 b/Tests/Private/Get-Map.Tests.ps1 new file mode 100644 index 0000000..040afda --- /dev/null +++ b/Tests/Private/Get-Map.Tests.ps1 @@ -0,0 +1,70 @@ +#Requires -Modules Pester +$global:here = (Split-Path -Parent $PSCommandPath) +$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0] + +Describe $global:function -Tag 'Unit', 'Source', 'Built' { + + InModuleScope -ModuleName ZertoApiWrapper { + Context "$global:function::Parameter Unit Tests" { + It "have a mandatory parameter for the Input Object" { + Get-Command $global:function | Should -HaveParameter InputObject -Mandatory -Type PSCustomObject + } + + It "Input Object should not accecpt a Null or Empty value" { + $myObj = [PSCustomObject]@{ } + { Get-Map -InputObject $myObj -Key "Key" -Value "Value" } | Should Throw + { Get-Map -InputObject $null -Key "Key" -Value "Value" } | Should Throw + { Get-Map -InputObject "" -Key "Key" -Value "Value" } | Should Throw + } + + It "have a mandatory string parameter for the Map Key" { + Get-Command $global:function | Should -HaveParameter Key -Mandatory -Type String + } + + It "The Map variable should not accecpt a Null or Empty value" { + $myObj = [PSCustomObject]@{one = 1; two = 2 } + { Get-Map -InputObject $myObj -Key "" -Value "Value" } | Should Throw + { Get-Map -InputObject $null -Key $null -Value "Value" } | Should Throw + { Get-Map -InputObject $myObj -Key 1 -Value "Value" } | Should Throw + } + + It "The Value variable should not accecpt a Null or Empty value" { + $myObj = [PSCustomObject]@{one = 1; two = 2 } + { Get-Map -InputObject $myObj -Key "Key" -Value "" } | Should Throw + { Get-Map -InputObject $myObj -Key "Key" -Value $null } | Should Throw + { Get-Map -InputObject $myObj -Key "Key" -Value 1 } | Should Throw + } + + It "have a mandatory string parameter for the Map Value" { + Get-Command $global:function | Should -HaveParameter Value -Mandatory -Type String + } + + It "should have an Output type of Hashtable" { + (Get-Command $global:function).OutputType.Name | Should -Match "Hashtable" + } + } + + Context "$global:function::Function Tests" { + $myObj = Get-Content "$global:here/Mocks/ProtectedVMs.json" | ConvertFrom-Json + BeforeEach { + $MyMap = Get-Map -InputObject $MyObj -Key "vmIdentifier" -Value "vmName" + } + It "Returned object should be a hashtable" { + $myMap | Should -BeOfType Hashtable + } + + It "should return a hashtable with 3 entries" { + $myMap.count | Should -Be 3 + } + + It "should be properly mapped" { + $myMap["vmid.12"] | Should -Be "ExchangeMailbox" + $myMap["vmid.13"] | Should -Be "ExchangeApplication" + $myMap["vmid.14"] | Should -Be "ExchangeWeb" + } + } + } +} + +Remove-Variable -Name function -Scope Global +Remove-Variable -Name here -Scope Global diff --git a/Tests/Private/Get-ZertoApiFilter.Tests.ps1 b/Tests/Private/Get-ZertoApiFilter.Tests.ps1 index 92af238..ce0fbfb 100644 --- a/Tests/Private/Get-ZertoApiFilter.Tests.ps1 +++ b/Tests/Private/Get-ZertoApiFilter.Tests.ps1 @@ -1,30 +1,74 @@ -$filePath = (Split-Path -Parent $MyInvocation.MyCommand.Path) -replace 'Tests', 'ZertoApiWrapper' -$fileName = (Split-Path -Leaf $MyInvocation.MyCommand.Path ) -replace '.Tests.', '.' -$file = Get-ChildItem "$filePath\$fileName" - -. $file.FullName -$singleBoolItemTest = @{"BoolItem" = $True} -$oneItemTest = @{"OneItem" = "Test"} -$twoItemTest = @{"OneItem" = "Test"; "SecondItem" = "Yours"} -$boolItemTest = @{"OneItem" = "Test"; "BoolItem" = $true} - -Describe $file.BaseName -Tag Unit { - it "file should exist" { - $file.Fullname | should exist - } +#Requires -Modules Pester +$global:here = (Split-Path -Parent $PSCommandPath) +$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0] - It "is valid Powershell (Has no script errors)" { - $contents = Get-Content -Path $file.Fullname -ErrorAction Stop - $errors = $null - $null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors) - $errors | Should -HaveCount 0 - } +Describe $global:function -Tag 'Unit', 'Source', 'Built' { - it "converts bool to text" { - Get-ZertoApiFilter -filtertable $singleBoolItemTest | should -Be "?BoolItem=True" - } - it "one item test" { - Get-ZertoApiFilter -filtertable $oneItemTest | should be "?OneItem=Test" + InModuleScope -ModuleName ZertoApiWrapper { + Context "$global:function::Parameter Unit Tests" { + It "has a mandatory hashtable parameter for the filterTable" { + Get-Command $global:function | Should -HaveParameter filterTable -Mandatory -Type Hashtable + } + + It "FilterTable should not accecpt a Null or Empty parameter" { + { Get-ZertoApiFilter -filtertable (@{ }) } | Should Throw + { Get-ZertoApiFilter -filtertable "" } | Should Throw + { Get-ZertoApiFilter -filtertable $null } | Should Throw + } + + It "should have an Output type of String" { + (Get-Command $global:function).OutputType.Name | Should -Match "String" + } + } + + Context "$global:function::Function Unit Tests" { + BeforeAll { + $singleBoolItemTest = @{"BoolItem" = $True } + $oneItemTest = @{ OneItem = "Test" } + $twoItemTest = @{ + OneItem = "Test" + SecondItem = "Yours" + } + $commonParamTest = @{ + Debug = $True + ErrorAction = "Stop" + ErrorVariable = "ErrVar" + InformationAction = "Continue" + InformationVariable = "InfoVar" + OutVariable = "OutVar" + OutBuffer = "OutBuff" + PipelineVariable = "PipeVar" + Verbose = $false + WarningAction = "SilentlyContinue" + WarningVariable = "WarnVar" + WhatIf = $True + Confirm = $false + OneItem = "Test" + } + } + + It "converts bool to text" { + Get-ZertoApiFilter -filtertable $singleBoolItemTest | Should -Be "?BoolItem=True" + } + + It "one item test" { + Get-ZertoApiFilter -filtertable $oneItemTest | Should -Be "?OneItem=Test" + } + + It "should ignore CommonParameters" { + Get-ZertoApiFilter -filtertable $commonParamTest | Should -Be "?OneItem=Test" + } + + It "should process a filter table with more than one item" { + $returnString = Get-ZertoApiFilter -filtertable $twoItemTest + $returnString | Should -match "^\?" + $returnString | Should -match "&" + $returnString | Should -match "OneItem=Test" + $returnString | Should -match "SecondItem=Yours" + } + } } - #TODO:: Figure out multi-item tests } + +Remove-Variable -Name function -Scope Global +Remove-Variable -Name here -Scope Global diff --git a/Tests/Private/Invoke-ZertoRestRequest.Tests.ps1 b/Tests/Private/Invoke-ZertoRestRequest.Tests.ps1 deleted file mode 100644 index 984d682..0000000 --- a/Tests/Private/Invoke-ZertoRestRequest.Tests.ps1 +++ /dev/null @@ -1,17 +0,0 @@ -$filePath = (Split-Path -Parent $MyInvocation.MyCommand.Path) -replace 'Tests', 'ZertoApiWrapper' -$fileName = (Split-Path -Leaf $MyInvocation.MyCommand.Path ) -replace '.Tests.', '.' -$file = Get-ChildItem "$filePath\$fileName" -. $file.FullName - -Describe $file.BaseName -Tag Unit { - it "file should exist" { - $file.FullName | should exist - } - - It "is valid Powershell (Has no script errors)" { - $contents = Get-Content -Path $file.FullName -ErrorAction Stop - $errors = $null - $null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors) - $errors | Should -HaveCount 0 - } -} \ No newline at end of file diff --git a/Tests/Private/Mocks/ProtectedVMs.json b/Tests/Private/Mocks/ProtectedVMs.json new file mode 100644 index 0000000..cf4924b --- /dev/null +++ b/Tests/Private/Mocks/ProtectedVMs.json @@ -0,0 +1,15 @@ +[ + { + "VMname": "ExchangeMailbox", + "VMIdentifier": "vmid.12" + }, + { + "VMName": "ExchangeApplication", + "VmIdentifier": "vmid.13" + }, + { + "VMName": "ExchangeWeb", + "VmIdentifier": "vmid.14" + } +] + diff --git a/Tests/Public/Add-ZertoPeerSite.Tests.ps1 b/Tests/Public/Add-ZertoPeerSite.Tests.ps1 index a55ee59..81f590f 100644 --- a/Tests/Public/Add-ZertoPeerSite.Tests.ps1 +++ b/Tests/Public/Add-ZertoPeerSite.Tests.ps1 @@ -1,76 +1,94 @@ #Requires -Modules Pester -$moduleFileName = "ZertoApiWrapper.psd1" -$here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper") -$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".") -$file = Get-ChildItem "$here\$sut" -$modulePath = $here -replace "Public", "" -$moduleFile = Get-ChildItem "$modulePath\$moduleFileName" -Get-Module -Name ZertoApiWrapper | Remove-Module -Force -Import-Module $moduleFile -Force - -Describe $file.BaseName -Tag 'Unit' { - - It "Is valid Powershell (Has no script errors)" { - $contents = Get-Content -Path $file -ErrorAction Stop - $errors = $null - $null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors) - $errors | Should -HaveCount 0 +$global:here = (Split-Path -Parent $PSCommandPath) +$global:function = ((Split-Path -Leaf $PSCommandPath).Split('.'))[0] + +Describe $global:function -Tag 'Unit', 'Source', 'Built' { + BeforeAll { + $script:ScriptBlock = (Get-Command $global:function).ScriptBlock } - Context "$($file.BaseName)::Parameter Unit Tests" { + Context "$global:function::Parameter Unit Tests" { - it "Has a mandatory string parameter for the target host" { - Get-Command $file.BaseName | Should -HaveParameter TargetHost -Mandatory -Type String + It "$global:function should have exactly 16 parameters defined" { + (Get-Command $global:function).Parameters.Count | Should -Be 16 } - it "Will not take a non-ip address as a 'TargetHost'" { - {Add-ZertoPeerSite -targetHost 'MyZVMHost' -targetPort '9081'} | should -Throw - {Add-ZertoPeerSite -targetHost '192.168.1.266' -targetPort '9081'} | should -Throw - {Add-ZertoPeerSite -targetHost '192.168.1' -targetPort '9081'} | should -Throw - {Add-ZertoPeerSite -targetHost $null -targetPort '9081'} | should -Throw + $ParameterTestCases = @( + @{ParameterName = 'targetHost'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'targetPort'; Type = 'Int32'; Mandatory = $false; Validation = 'Range' } + @{ParameterName = 'token'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } + ) + + It " parameter is of type" -TestCases $ParameterTestCases { + param($ParameterName, $Type, $Mandatory, $Validation) + Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type } - it "Has a non-mandatory string parameter for the target port with default value of 9081" { - Get-Command $file.BaseName | Should -HaveParameter TargetPort -Not -Mandatory - Get-Command $file.BaseName | Should -HaveParameter TargetPort -Type Int32 - Get-Command $file.BaseName | Should -HaveParameter TargetPort -DefaultValue 9081 + It " parameter has correct validation setting" -TestCases $ParameterTestCases { + param($ParameterName, $Validation) + Switch ($Validation) { + 'Range' { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.Where{ $_ -is [ValidateRange] }.Count | Should -Be 1 + } + + 'NotNullOrEmpty' { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1 + } + + default { + $true | Should -Be $false -Because "No Validation Selected. Review test cases" + } + } } - it "Will not take a non-int as a port" { - {Add-ZertoPeerSite -targetHost '192.168.1.100' -targetPort 'string'} | should -Throw - {Add-ZertoPeerSite -targetHost '192.168.1.100' -targetPort $true} | should -Throw - {Add-ZertoPeerSite -targetHost '192.168.1.100' -targetPort $null} | should -Throw + It "targetPort Parameter should have a default value of 9081" { + Get-Command $global:function | Should -HaveParameter targetPort -DefaultValue 9081 } - It "Will fail if the specified port is outside of the range 1024 - 65535" { - {Add-ZertoPeerSite -targetHost '192.168.1.100' -targetPort 1023} | Should -Throw - {Add-ZertoPeerSite -targetHost '192.168.1.100' -targetPort 65536} | Should -Throw - {Add-ZertoPeerSite -targetHost '192.168.1.100' -targetPort 0} | Should -Throw - {Add-ZertoPeerSite -targetHost '192.168.1.100' -targetPort -1} | Should -Throw + It "targetPort Parameter should have a Min value of 1024" { + (Get-Command $global:function).Parameters['targetPort'].Attributes.Where{ $_ -is [ValidateRange] }.MinRange | Should -Be 1024 } - it "Supports 'SupportsShouldProcess'" { - Get-Command $file.BaseName | Should -HaveParameter WhatIf - Get-Command $file.BaseName | Should -HaveParameter Confirm - $file | Should -FileContentMatch 'SupportsShouldProcess' - $file | Should -FileContentMatch '\$PSCmdlet\.ShouldProcess\(.+\)' + It "targetPort Parameter should have a Max value of 65535" { + (Get-Command $global:function).Parameters['targetPort'].Attributes.Where{ $_ -is [ValidateRange] }.MaxRange | Should -Be 65535 } - } - Context "$($file.BaseName)::Function Unit Tests" { + It "Supports 'SupportsShouldProcess'" { + Get-Command $global:function | Should -HaveParameter WhatIf + Get-Command $global:function | Should -HaveParameter Confirm + $script:ScriptBlock | Should -Match 'SupportsShouldProcess' + $script:ScriptBlock | Should -Match '\$PSCmdlet\.ShouldProcess\(.+\)' + } + } - Mock -ModuleName ZertoApiWrapper Invoke-ZertoRestRequest { - return "9a49f42e-2bbd-4bf8-b571-77908a2e5e98.928a122b-1763-4664-ad37-cc00bb883f2f" + Context "Add-ZertoPeerSite::Functional Unit Tests" { + Mock -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest { + return (Get-Content "$global:here\Mocks\TaskId.txt") } - it "Returns a string value" { + It "Returns a string value when no Token Passed" { $results = Add-ZertoPeerSite -targetHost '192.168.1.100' -targetPort '9081' - $results | should -Not -BeNullOrEmpty - $results | should -BeOfType "String" - $results | Should -BeExactly "9a49f42e-2bbd-4bf8-b571-77908a2e5e98.928a122b-1763-4664-ad37-cc00bb883f2f" + $results | Should -Not -BeNullOrEmpty + $results | Should -BeOfType "String" + $results | Should -BeExactly "7e79035e-fb8c-47fe-815c-12ddd41708e6.3e4cdd0d-1064-4022-921f-6265ad6d335a" + } + + It "Returns a string value when a Token is passed" { + $results = Add-ZertoPeerSite -targetHost '192.168.1.100' -targetPort '9081' -token "NotARealTokenString" + $results | Should -Not -BeNullOrEmpty + $results | Should -BeOfType "String" + $results | Should -BeExactly "7e79035e-fb8c-47fe-815c-12ddd41708e6.3e4cdd0d-1064-4022-921f-6265ad6d335a" } - Assert-MockCalled -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest + It "Does not return a taskId if '-whatif' is used" { + $results = Add-ZertoPeerSite -targetHost '192.168.1.100' -targetPort '9081' -WhatIf + $results | Should -BeNullOrEmpty + } + + Assert-MockCalled -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -Exactly 2 } } - +Remove-Variable -Name here -Scope Global +Remove-Variable -Name function -Scope Global diff --git a/Tests/Public/Add-ZertoVpgVm.Tests.ps1 b/Tests/Public/Add-ZertoVpgVm.Tests.ps1 new file mode 100644 index 0000000..27af791 --- /dev/null +++ b/Tests/Public/Add-ZertoVpgVm.Tests.ps1 @@ -0,0 +1,53 @@ +#Requires -Modules Pester +$global:here = (Split-Path -Parent $PSCommandPath) +$global:function = ((Split-Path -Leaf $PSCommandPath).Split('.'))[0] + +Describe $global:function -Tag 'Unit', 'Source', 'Built' { + BeforeAll { + $script:ScriptBlock = (Get-Command $global:function).ScriptBlock + } + + Context "$global:function::Parameter Unit Tests" { + + It "$global:function should have exactly 16 parameters defined" { + (Get-Command $global:function).Parameters.Count | Should -Be 16 + } + + $ParameterTestCases = @( + @{ParameterName = 'vpgSettingsIdentifier'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'Vm'; Type = 'String[]'; Mandatory = $true; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'VpgName'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' } + ) + + It " parameter is of type" -TestCases $ParameterTestCases { + param($ParameterName, $Type, $Mandatory, $Validation) + Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type + } + + It " parameter has correct validation setting" -TestCases $ParameterTestCases { + param($ParameterName, $Validation) + Switch ($Validation) { + 'NotNullOrEmpty' { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1 + } + + default { + $true | Should -Be $false -Because "No Validation Selected. Review test cases" + } + } + } + + It "Supports 'SupportsShouldProcess'" { + Get-Command $global:function | Should -HaveParameter WhatIf + Get-Command $global:function | Should -HaveParameter Confirm + $script:ScriptBlock | Should -Match 'SupportsShouldProcess' + $script:ScriptBlock | Should -Match '\$PSCmdlet\.ShouldProcess\(.+\)' + } + } + + Context "Add-ZertoPeerSite::Functional Unit Tests" { + } +} +Remove-Variable -Name here -Scope Global +Remove-Variable -Name function -Scope Global diff --git a/Tests/Public/Checkpoint-ZertoVpg.Tests.ps1 b/Tests/Public/Checkpoint-ZertoVpg.Tests.ps1 index f07f347..4fbb862 100644 --- a/Tests/Public/Checkpoint-ZertoVpg.Tests.ps1 +++ b/Tests/Public/Checkpoint-ZertoVpg.Tests.ps1 @@ -1,66 +1,63 @@ #Requires -Modules Pester -$moduleFileName = "ZertoApiWrapper.psd1" -$here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper") -$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".") -$file = Get-ChildItem "$here\$sut" -$modulePath = $here -replace "Public", "" -$moduleFile = Get-ChildItem "$modulePath\$moduleFileName" -Get-Module -Name ZertoApiWrapper | Remove-Module -Force -Import-Module $moduleFile -Force +$global:here = (Split-Path -Parent $PSCommandPath) +$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0] -Describe $file.BaseName -Tag 'Unit' { - - It "is valid Powershell (Has no script errors)" { - $contents = Get-Content -Path $file -ErrorAction Stop - $errors = $null - $null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors) - $errors | Should -HaveCount 0 +Describe $global:function -Tag 'Unit', 'Source', 'Built' { + BeforeAll { + $script:ScriptBlock = (Get-Command $global:function).ScriptBlock } Mock -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest { - return "3b687246-ac63-40da-9a59-b99863769eb0.928a122b-1763-4664-ad37-cc00bb883f2f" + return (Get-Content "$global:here\Mocks\TaskId.txt") } - Mock -ModuleName ZertoApiWrapper -CommandName get-zertovpg { - return @{vpgIdentifier = "dddf2fa8-79e2-4e4f-a83b-f66676afea64"} + Mock -ModuleName ZertoApiWrapper -CommandName get-zertovpg -ParameterFilter { $VpgName -eq "MyVpg" } { + return (Get-Content "$global:here\Mocks\VPGInfo.json" -Raw | ConvertFrom-Json) } - Context "$($file.BaseName)::Parameter Unit Tests" { - it "Has a parameter for the VpgName that is Mandatory" { - Get-Command $file.BaseName | Should -HaveParameter vpgName -Mandatory -Type String + Context "$($global:function)::Parameter Unit Tests" { + It "Has a parameter for the VpgName that is Mandatory" { + Get-Command $global:function | Should -HaveParameter vpgName -Mandatory -Type 'String[]' } - it "Has a parameter for the CheckpointName that is Mandatory" { - Get-Command $file.BaseName | Should -HaveParameter CheckpointName -Mandatory -Type String + It "Has a parameter for the CheckpointName that is Mandatory" { + Get-Command $global:function | Should -HaveParameter CheckpointName -Mandatory -Type String } - it "Throws and error when an empty or null checkpointName is specified" { - {Checkpoint-ZertoVpg -vpgName "MyVpg" -checkpointName ""} | Should -Throw - {Checkpoint-ZertoVpg -vpgName "MyVpg" -checkpointName $null} | Should -Throw + It "Throws and error when an empty or null checkpointName is specified" { + { Checkpoint-ZertoVpg -vpgName "MyVpg" -checkpointName "" } | Should -Throw + { Checkpoint-ZertoVpg -vpgName "MyVpg" -checkpointName $null } | Should -Throw } - it "Throws an error when an empty or null vpgName is specified" { - {Checkpoint-ZertoVpg -vpgName "" -checkpointName "MyCheckPoint"} | Should -Throw - {Checkpoint-ZertoVpg -vpgName $null -checkpointName "MyCheckPoint"} | Should -Throw + It "Throws an error when an empty or null vpgName is specified" { + { Checkpoint-ZertoVpg -vpgName "" -checkpointName "MyCheckPoint" } | Should -Throw + { Checkpoint-ZertoVpg -vpgName $null -checkpointName "MyCheckPoint" } | Should -Throw } - it "Does not support 'SupportsShouldProcess'" { - Get-Command $file.BaseName | Should -Not -HaveParameter WhatIf - Get-Command $file.BaseName | Should -Not -HaveParameter Confirm - $file | Should -Not -FileContentMatch 'SupportsShouldProcess' - $file | Should -Not -FileContentMatch '\$PSCmdlet\.ShouldProcess\(.+\)' + It "Does not support 'SupportsShouldProcess'" { + Get-Command $global:function | Should -Not -HaveParameter WhatIf + Get-Command $global:function | Should -Not -HaveParameter Confirm + $script:ScriptBlock | Should -not -match 'SupportsShouldProcess' + $script:ScriptBlock | Should -not -match '\$PSCmdlet\.ShouldProcess\(.+\)' } } - Context "$($file.BaseName)::Function Unit Tests" { + Context "$($global:function)::Function Unit Tests" { - it "should return a not null or empty string" { + It "should return a not null or empty string" { $results = Checkpoint-ZertoVpg -vpgName "MyVpg" -checkpointName "My Checkpoint Name" - $results | should -not -BeNullOrEmpty - $results | should -BeOfType "String" - $results | should -BeExactly "3b687246-ac63-40da-9a59-b99863769eb0.928a122b-1763-4664-ad37-cc00bb883f2f" + $results | Should -not -BeNullOrEmpty + $results | Should -BeOfType "String" + $results | Should -BeExactly "7e79035e-fb8c-47fe-815c-12ddd41708e6.3e4cdd0d-1064-4022-921f-6265ad6d335a" + } + It "does not return anything when a invalid VPG is defined" { + $results = Checkpoint-ZertoVpg -vpgName "DoesNotExist" -checkpointName "My Checkpoint Name" + $results | Should -Be "Cannot find VPG named DoesNotExist. Please check the name and try again." } - Assert-MockCalled -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest - Assert-MockCalled -ModuleName ZertoApiWrapper -CommandName Get-ZertoVpg + Assert-MockCalled -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -Exactly 2 + Assert-MockCalled -ModuleName ZertoApiWrapper -CommandName Get-ZertoVpg -Exactly 1 } -} \ No newline at end of file +} + +Remove-Variable -Name function -Scope Global +Remove-Variable -Name here -Scope Global diff --git a/Tests/Public/Connect-ZertoAnalytics.Tests.ps1 b/Tests/Public/Connect-ZertoAnalytics.Tests.ps1 new file mode 100644 index 0000000..d91ed80 --- /dev/null +++ b/Tests/Public/Connect-ZertoAnalytics.Tests.ps1 @@ -0,0 +1,72 @@ +#Requires -Modules Pester +$global:here = (Split-Path -Parent $PSCommandPath) +$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0] + +Describe $global:function -Tag 'Unit', 'Source', 'Built' { + BeforeAll { + $script:ScriptBlock = (Get-Command $global:function).ScriptBlock + } + + Context "$($global:function)::Parameter Unit Tests" { + It "Has a parameter for the Required Credentials that is Mandatory" { + Get-Command $global:function | Should -HaveParameter credential -Mandatory -Type PSCredential + } + } + + Context "$($global:function)::Function Unit Tests" { + + InModuleScope -ModuleName ZertoApiWrapper { + Mock -CommandName Invoke-ZARestRequest { + return (Get-Content "$global:here\Mocks\ZAToken.json"-Raw | ConvertFrom-Json) + } + + $password = 'NotARealPassword' | ConvertTo-SecureString -AsPlainText -Force + $cred = New-Object pscredential('NotARealUser', $password) + + $results = Connect-ZertoAnalytics -credential $cred + + It "Creates a Script Level Hashtable Variable for the ZertoAnalytics Headers" { + $script:zaHeaders | Should -BeOfType Hashtable + } + + It "the ZertoAnalytics Headers variable contains 2 items" { + $script:zaHeaders.keys | Should -HaveCount 2 + } + + It "the ZertoAnalytics Headers variable has an 'Accept' key" { + $script:zaHeaders.keys | Should -Contain 'Accept' + } + + It "thh ZertoAnalytics headers variable 'Accept' key should be JSON" { + $script:zaHeaders['Accept'] | Should -match 'application/json' + } + + It "the ZertoAnalytics Headers variable has an 'Authorization' key" { + $script:zaHeaders.keys | Should -Contain 'Authorization' + } + + It "the ZertoAnalytics Headers variable 'Authorization' key should start with 'Bearer'" { + $script:zaHeaders['Authorization'] | Should -Match '^Bearer ' + } + + It "Creates a Script Level Variable for the LastActionTime" { + $script:zaLastActionTime | Should -BeOfType Long + } + + It "LastActionTime Variable should be in the past" { + $script:zaLastActionTime | Should -BeLessThan (Get-Date).Ticks + } + + It "Returns Header Information" { + $results | Should -not -BeNullOrEmpty + $results['Authorization'] | Should -MatchExactly 'Bearer N074r34l70k3n' + $results['Accept'] | Should -Match 'application/json' + } + } + + Assert-MockCalled -ModuleName ZertoApiWrapper -CommandName Invoke-ZARestRequest -Exactly 1 + } +} + +Remove-Variable -Name function -Scope Global +Remove-Variable -Name here -Scope Global diff --git a/Tests/Public/Connect-ZertoServer.Tests.ps1 b/Tests/Public/Connect-ZertoServer.Tests.ps1 index 59c5e8b..802cc9b 100644 --- a/Tests/Public/Connect-ZertoServer.Tests.ps1 +++ b/Tests/Public/Connect-ZertoServer.Tests.ps1 @@ -1,203 +1,142 @@ #Requires -Modules Pester -$moduleFileName = "ZertoApiWrapper.psd1" -$here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper") -$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".") -$file = Get-ChildItem "$here\$sut" -$modulePath = $here -replace "Public", "" -$moduleFile = Get-ChildItem "$modulePath\$moduleFileName" -Get-Module -Name ZertoApiWrapper | Remove-Module -Force -Import-Module $moduleFile -Force -$userName = "zerto\build" -$password = ConvertTo-SecureString -String "ZertoBuild" -AsPlainText -Force -$credential = New-Object -TypeName System.Management.Automation.PSCredential($userName, $password) -$Server = "192.168.1.100" -$zertoPort = "7669" - -Describe $file.BaseName -Tag Unit { - - It "is valid Powershell (Has no script errors)" { - $contents = Get-Content -Path $file -ErrorAction Stop - $errors = $null - $null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors) - $errors | Should -HaveCount 0 +$global:here = (Split-Path -Parent $PSCommandPath) +$global:function = ((Split-Path -Leaf $PSCommandPath).Split('.'))[0] + +Describe $global:function -Tag 'Unit', 'Source', 'Built' { + BeforeAll { + $script:ScriptBlock = (Get-Command $global:function).ScriptBlock } - Context "$($file.BaseName)::Parameter Unit Tests" { + Context "$($global:function)::Parameter Unit Tests" { - it "server vairable has a mandatory String parameter" { - Get-Command $file.BaseName | Should -HaveParameter zertoserver -Mandatory -Type String + It "server vairable has a mandatory String parameter" { + Get-Command $global:function | Should -HaveParameter zertoserver -Mandatory -Type String } - it "server variable does not accecpt an empty or null input" { - {Connect-ZertoServer -zertoServer $null -credential $credential} | Should -Throw - {Connect-ZertoServer -zertoServer "" -credential $credential} | Should -Throw + It "server variable does not accecpt an empty or null input" { + { Connect-ZertoServer -zertoServer $null -credential $credential } | Should -Throw + { Connect-ZertoServer -zertoServer "" -credential $credential } | Should -Throw } - it "port variable has a non-mandatory String parameter" { - Get-Command $file.BaseName | Should -HaveParameter zertoPort -Not -Mandatory - Get-Command $file.BaseName | Should -HaveParameter zertoPort -Type String - Get-Command $file.BaseName | Should -HaveParameter zertoPort -DefaultValue "9669" + It "port variable has a non-mandatory String parameter" { + Get-Command $global:function | Should -HaveParameter zertoPort -Not -Mandatory + Get-Command $global:function | Should -HaveParameter zertoPort -Type String + Get-Command $global:function | Should -HaveParameter zertoPort -DefaultValue "9669" } - it "port variable does not accecpt an empty or null input" { - {Connect-ZertoServer -zertoServer "192.168.1.100" -zertoPort "" -credential $credential} | Should -Throw - {Connect-ZertoServer -zertoServer "192.168.1.100" -zertoPort $null -credential $credential} | Should -Throw + It "port variable does not accecpt an empty or null input" { + { Connect-ZertoServer -zertoServer "192.168.1.100" -zertoPort "" -credential $credential } | Should -Throw + { Connect-ZertoServer -zertoServer "192.168.1.100" -zertoPort $null -credential $credential } | Should -Throw } - it "port variable should fall between 1024 and 65535" { - {Connect-ZertoServer -zertoServer $Server -zertoPort 1023 -credential $credential} | Should -Throw - {Connect-ZertoServer -zertoServer $Server -zertoPort 65536 -credential $credential} | Should -Throw - {Connect-ZertoServer -zertoServer $Server -zertoPort 0 -credential $credential} | Should -Throw - {Connect-ZertoServer -zertoServer $Server -zertoPort -1 -credential $credential} | Should -Throw + It "port variable should fall between 1024 and 65535" { + { Connect-ZertoServer -zertoServer $Server -zertoPort 1023 -credential $credential } | Should -Throw + { Connect-ZertoServer -zertoServer $Server -zertoPort 65536 -credential $credential } | Should -Throw + { Connect-ZertoServer -zertoServer $Server -zertoPort 0 -credential $credential } | Should -Throw + { Connect-ZertoServer -zertoServer $Server -zertoPort -1 -credential $credential } | Should -Throw } - it "has a mandatory PSCredential parameter for the credential vairable" { - Get-Command $file.BaseName | Should -HaveParameter credential -Mandatory -Type PSCredential + It "has a mandatory PSCredential parameter for the credential vairable" { + Get-Command $global:function | Should -HaveParameter credential -Mandatory -Type PSCredential } - it "should require a PSCredentialObject for the credentials" { - {Connect-ZertoServer -zertoServer -credential "MyUsername"} | Should -Throw - {Connect-ZertoServer -zertoServer -credential 1234} | Should -Throw - {Connect-ZertoServer -zertoServer -credential $(@{Username = "zerto\build"; Password = 'SecureString'})} | Should -Throw + It "should require a PSCredentialObject for the credentials" { + { Connect-ZertoServer -zertoServer -credential "MyUsername" } | Should -Throw + { Connect-ZertoServer -zertoServer -credential 1234 } | Should -Throw + { Connect-ZertoServer -zertoServer -credential $(@{Username = "zerto\build"; Password = 'SecureString' }) } | Should -Throw } - } - InModuleScope ZertoApiWrapper { - Context "$($file.BaseName)::InModuleScope Function Unit Tests" { + It "has a switch parameter to return the headers" { + Get-Command $global:function | Should -HaveParameter returnHeaders + Get-Command $global:function | Should -HaveParameter returnHeaders -Type Switch + } - $server = '192.168.1.100' - $userName = "zerto\build" - $password = ConvertTo-SecureString -String "ZertoBuild" -AsPlainText -Force - $credential = New-Object -TypeName System.Management.Automation.PSCredential($userName, $password) + It "has a switch parameter to auto reauthorize the session" { + Get-Command $global:function | Should -HaveParameter autoReconnect + Get-Command $global:function | Should -HaveParameter autoReconnect -Type Switch + } + } + InModuleScope -ModuleName ZertoApiWrapper { + Mock -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest { + # Attempted to Mock this per the Mock Below and it blew up. Auth Headers Returns a Dictionary + # and does not index the same way when imported from a JSON file. Need addtional investigation. + $xZertoSession = @("e34da0b0-4bc2-4cda-b316-0384e35bdca5") + $Headers = @{'x-zerto-session' = $xZertoSession } + $results = @{'Headers' = $Headers } + return $results + } - Mock -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest { - $xZertoSession = @("7ecf544d-e7ed-4108-86f3-fb355c51cdfa") - $Headers = @{'x-zerto-session' = $xZertoSession} - $results = @{'Headers' = $Headers} - return $results - } + Context "$($global:function)::InModuleScope Function Unit Tests" { - Mock -ModuleName ZertoApiWrapper -CommandName Get-ZertoLocalSite { - $results = @{ - BandwidthThrottlingInMBs = -1 - ContactEmail = "vSphere-Site01@zerto.com" - ContactName = "vSphere-Site01@zerto.com" - ContactPhone = "066-6666666" - IpAddress = "192.168.200.1" - IsReplicationToSelfEnabled = $True - Link = @{ - href = "https://192.168.24.1:7669/v1/localsite" - identifier = "928a122b-1763-4664-ad37-cc00bb883f2f" - rel = $null - type = "LocalSiteApi" - } - Location = "vSphere-Site01" - SiteName = "vSphere-Site01 at Zerto" - SiteType = "VCenter" - UtcOffsetInMinutes = -240 - Version = "7.0.0" - SiteIdentifier = "928a122b-1763-4664-ad37-cc00bb883f2f" - } - return $results + BeforeAll { + $server = '192.168.1.100' + $password = ConvertTo-SecureString -String "NotARealPassword" -AsPlainText -Force + $credential = New-Object pscredential('NotARealUser', $password) + $now = $(Get-Date).ticks + Connect-ZertoServer -zertoServer $server -credential $credential } - $now = $(Get-Date).ticks - Connect-ZertoServer -zertoServer $server -credential $credential - - it "Module Scope zvmServer variable tests" { + It "Module Scope zvmServer variable tests" { $script:zvmServer | Should -Not -BeNullOrEmpty $script:zvmServer | Should -Be $server } - it "Module Scope zvmPort variable tests" { + It "Module Scope zvmPort variable tests" { $script:zvmPort | Should -Not -BeNullOrEmpty $script:zvmPort | Should -Be '9669' } - it "Module Scope zvmLastAction variable tests" { + It "Module Scope zvmLastAction variable tests" { $script:zvmLastAction | Should -Not -BeNullOrEmpty $script:zvmLastAction | Should -BeGreaterOrEqual $now } - it "Module Scope zvmHeaders variable tests" { + It "Module Scope zvmHeaders variable tests" { $script:zvmHeaders | Should -Not -BeNullOrEmpty - $script:zvmHeaders | Should -BeOfType Hashtable - $script:zvmHeaders.keys.count | Should -BeExactly 2 + $script:zvmHeaders | Should -BeOfType PSCustomObject + $script:zvmHeaders.keys.count | Should -BeExactly 3 $script:zvmHeaders.ContainsKey('x-zerto-session') | Should -BeTrue $script:zvmHeaders.ContainsKey('Accept') | Should -BeTrue $script:zvmHeaders['x-zerto-session'] | Should -BeOfType String $script:zvmHeaders['Accept'] | Should -BeOfType String } - it "Module Scope zvmLocalInfo variable tests" { - $script:zvmLocalInfo | Should -Not -BeNullOrEmpty - $script:zvmLocalInfo | Should -BeOfType Hashtable - $script:zvmLocalInfo['SiteIdentifier'] | Should -BeOfType String - $script:zvmLocalInfo.ContainsKey('SiteIdentifier') | Should -BeTrue - $script:zvmLocalInfo['SiteIdentifier'] | Should -BeOfType String - } - $headers = Connect-ZertoServer -zertoServer $Server -credential $credential -returnHeaders - it "returns a Hashtable with 2 keys" { + It "returns a Hashtable with 2 keys" { $headers | Should -BeOfType Hashtable - $headers.keys.count | should be 2 + $headers.keys.count | Should -Be 3 } - it "return value has a key called 'x-zerto-session'" { - $headers.ContainsKey('x-zerto-session') | should be $true + It "return value has a key called 'x-zerto-session'" { + $headers.ContainsKey('x-zerto-session') | Should -Be $true } - it "return key 'x-zerto-session' value should be a string" { - $headers['x-zerto-session'] | should -BeOfType "String" - $headers['x-zerto-session'] | Should -BeExactly "7ecf544d-e7ed-4108-86f3-fb355c51cdfa" + It "return key 'x-zerto-session' value should be a string" { + $headers['x-zerto-session'] | Should -BeOfType "String" + $headers['x-zerto-session'] | Should -BeExactly "e34da0b0-4bc2-4cda-b316-0384e35bdca5" } - it "return value has a key called 'accept'" { - $headers.ContainsKey('accept') | should be $true + It "return value has a key called 'accept'" { + $headers.ContainsKey('accept') | Should -Be $true } - it "return key 'accept' value should be 'application/json'" { - $headers['accept'] | should be 'application/json' + It "return key 'accept' value should be 'application/json'" { + $headers['accept'] | Should -Be 'application/json' } - it "should not require a port to be specified" { + It "should not require a port to be specified" { Connect-ZertoServer -zertoServer $Server -credential $credential } - it "returns null when -ReturnHeaders is not used" { + It "returns null when -ReturnHeaders is not used" { Connect-ZertoServer -zertoServer $Server -credential $credential | Should -BeNullOrEmpty } - Assert-MockCalled -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest - Assert-MockCalled -ModuleName ZertoApiWrapper -CommandName Get-ZertoLocalSite + Assert-MockCalled -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -Exactly 4 } } } -<# -Describe "Connect-ZertoServer" -Tag Integration { - it "file should exist" { - "$filePath\$fileName" | should exist - } - it "has a function called Connect-ZertoServer" { - get-command Connect-ZertoServer | should be $true - } - $headers = Connect-ZertoServer -zertoServer $Server -zertoPort $zertoPort -credential $credential -returnHeaders - it "returns a Hashtable with 2 keys" { - $headers.keys.count | should be 2 - } - it "return value has a key called 'x-zerto-session'" { - $headers.ContainsKey('x-zerto-session') | should be $true - } - it "return key 'x-zerto-session' value should be a string" { - $headers['x-zerto-session'].gettype().name | should be "String" - } - it "return value has a key called 'accept'" { - $headers.ContainsKey('accept') | should be $true - } - it "return key 'accept' value should be 'application/json'" { - $headers['accept'] | should be 'application/json' - } - Disconnect-ZertoServer -} - #> + +Remove-Variable -Name function -Scope Global +Remove-Variable -Name here -Scope Global diff --git a/Tests/Public/Copy-ZertoVpg.Tests.ps1 b/Tests/Public/Copy-ZertoVpg.Tests.ps1 new file mode 100644 index 0000000..6f0c629 --- /dev/null +++ b/Tests/Public/Copy-ZertoVpg.Tests.ps1 @@ -0,0 +1,127 @@ +#Requires -Modules Pester +$global:here = (Split-Path -Parent $PSCommandPath) +$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0] + +Describe $global:function -Tag 'Unit', 'Source', 'Built' { + BeforeAll { + $script:ScriptBlock = (Get-Command $global:function).ScriptBlock + } + + Context "$($global:function)::Parameter Unit Tests" { + + It "$global:function should have exactly 16 parameters defined" { + (Get-Command $global:function).Parameters.Count | Should -Be 16 + } + + $ParameterTestCases = @( + @{ParameterName = 'SourceVpgName'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'NewVpgName'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'VMs'; Type = 'String[]'; Mandatory = $true; Validation = 'NotNullOrEmpty' } + ) + + It " parameter is of type" -TestCases $ParameterTestCases { + param($ParameterName, $Type, $Mandatory) + Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type + } + + It " parameter has correct validation setting" -TestCases $ParameterTestCases { + param($ParameterName, $Validation) + Switch ($Validation) { + 'NotNullOrEmpty' { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1 + } + + $null { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.TypeId.Count | Should -Be 2 + } + } + } + + It "Supports 'SupportsShouldProcess'" { + Get-Command $global:function | Should -HaveParameter WhatIf + Get-Command $global:function | Should -HaveParameter Confirm + $script:ScriptBlock | Should -match 'SupportsShouldProcess' + $script:ScriptBlock | Should -match '\$PSCmdlet\.ShouldProcess\(.+\)' + } + } + + Context "$($global:function)::Function Unit Tests" { + Mock -ModuleName ZertoApiWrapper -CommandName Get-ZertoVpg -ParameterFilter { + $vpgName -eq "MyVpg" + } { + return (Get-Content "$global:here\Mocks\GetVpg.json" -Raw | ConvertFrom-Json) + } -Verifiable + Mock -ModuleName ZertoApiWrapper -CommandName Get-ZertoVpg -ParameterFilter { + $vpgName -eq "NotAVpg" + } { + return $null + } -Verifiable + Mock -ModuleName ZertoApiWrapper -CommandName Get-ZertoUnprotectedVm { + return (Get-Content "$global:here\Mocks\UnprotectedVms.json" -Raw | ConvertFrom-Json) + } -Verifiable + Mock -ModuleName ZertoApiWrapper -CommandName Get-ZertoProtectedVm { + return (Get-Content "$global:here\Mocks\ProtectedVms.json" -Raw | ConvertFrom-Json) + } -Verifiable + Mock -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -ParameterFilter { + $uri -eq "vpgSettings/copyVpgSettings" + } { + return (Get-Content "$global:here\Mocks\VpgId.txt") + } -Verifiable + Mock -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -ParameterFilter { + $uri -eq "vpgSettings/9607f923-00a7-477b-8b04-26a386214455/vms" + } { + return $null + } -Verifiable + Mock -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -ParameterFilter { + $uri -eq "vpgSettings/9607f923-00a7-477b-8b04-26a386214455" + } { + return (Get-Content "$global:here\Mocks\CopyVpgSettings.json" -Raw | ConvertFrom-Json) + } -Verifiable + Mock -ModuleName ZertoApiWrapper -CommandName Save-ZertoVpgSetting { + return (Get-Content "$global:here\Mocks\TaskId.txt") + } -Verifiable + Mock -ModuleName ZertoApiWrapper -CommandName Get-Map -ParameterFilter { + $null -ne $InputObject[0].VpgName + } { + @{ + "WindowsBox" = "d809de8e-deb7-45cc-b620-08030a1143e1.vm-90" + "CentOS-Test" = "d809de8e-deb7-45cc-b620-08030a1143e1.vm-88" + "Application01" = "d809de8e-deb7-45cc-b620-08030a1143e1.vm-35" + "sql01-test" = "d809de8e-deb7-45cc-b620-08030a1143e1.vm-73" + "jenkins" = "d809de8e-deb7-45cc-b620-08030a1143e1.vm-75" + } + } -Verifiable + Mock -ModuleName ZertoApiWrapper -CommandName Get-Map -ParameterFilter { + $null -eq $InputObject[0].VpgName + } { + @{ + "Win2019Template" = "d809de8e-deb7-45cc-b620-08030a1143e1.vm-79" + "Ubuntu01" = "d809de8e-deb7-45cc-b620-08030a1143e1.vm-34" + "WinTemplate" = "d809de8e-deb7-45cc-b620-08030a1143e1.vm-25" + "sql01-prod" = "d809de8e-deb7-45cc-b620-08030a1143e1.vm-87" + "nczvm.nc.lab" = "d809de8e-deb7-45cc-b620-08030a1143e1.vm-30" + } + } -Verifiable + + It "Should throw an error when no VPG is found" { + { Copy-ZertoVpg -SourceVpgName "NotAVpg" -NewVpgName "NewVpg" -VMs 'sql01-prod', 'Ubuntu01' } | Should Throw "Unable to find a VPG with the name:" + } + + It "Returns a TaskIdentifier when called correctly" { + Copy-ZertoVpg -SourceVpgName "MyVpg" -NewVpgName "NewVpg" -VMs 'sql01-prod', 'Ubuntu01' | Should -Be "7e79035e-fb8c-47fe-815c-12ddd41708e6.3e4cdd0d-1064-4022-921f-6265ad6d335a" + } + + It "Should warn when VM is not found" { + $results = Copy-ZertoVpg -SourceVpgName "MyVpg" -NewVpgName "NewVpg" -VMs 'sql01-prod', 'Ubuntu01', 'DoesNotExist' 3>&1 + $results[0].ToString() | Should -Match 'Unable to find VM with Name DoesNotExist. Skipping.' + + } + + Assert-VerifiableMock + } +} + +Remove-Variable -Name function -Scope Global +Remove-Variable -Name here -Scope Global diff --git a/Tests/Public/Disconnect-ZertoServer.Tests.ps1 b/Tests/Public/Disconnect-ZertoServer.Tests.ps1 index 5be178d..51e5f2c 100644 --- a/Tests/Public/Disconnect-ZertoServer.Tests.ps1 +++ b/Tests/Public/Disconnect-ZertoServer.Tests.ps1 @@ -1,37 +1,40 @@ #Requires -Modules Pester -$moduleFileName = "ZertoApiWrapper.psd1" -$here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper") -$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".") -$file = Get-ChildItem "$here\$sut" -$modulePath = $here -replace "Public", "" -$moduleFile = Get-ChildItem "$modulePath\$moduleFileName" -Get-Module -Name ZertoApiWrapper | Remove-Module -Force -Import-Module $moduleFile -Force +$global:here = (Split-Path -Parent $PSCommandPath) +$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0] -Describe $file.BaseName -Tag 'Unit' { - Mock -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest { - $null - } - Mock -ModuleName ZertoApiWrapper -CommandName Remove-Variable { +Describe $global:function -Tag 'Unit', 'Source', 'Built' { + Context "$($global:function)::Parameter Unit Tests" { + It "Does not take any parameters" { + (Get-Command disconnect-zertoserver).parameters.count | Should -BeExactly 11 + } } - It "is valid Powershell (Has no script errors)" { - $contents = Get-Content -Path $file -ErrorAction Stop - $errors = $null - $null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors) - $errors | Should -HaveCount 0 - } + Context "$($global:function)::Function Unit Tests" { + InModuleScope -ModuleName ZertoApiWrapper { + Mock -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest { + # Attempted to Mock this per the Mock Below and it blew up. Auth Headers Returns a Dictionary + # and does not index the same way when imported from a JSON file. Need addtional investigation. + $xZertoSession = @("e34da0b0-4bc2-4cda-b316-0384e35bdca5") + $Headers = @{'x-zerto-session' = $xZertoSession } + $results = @{'Headers' = $Headers } + return $results + } - Context "$($file.BaseName)::Parameter Unit Tests" { - it "Does not take any parameters" { - (get-command disconnect-zertoserver).parameters.count | Should -BeExactly 11 - } - } + Mock -ModuleName ZertoApiWrapper -CommandName Get-ZertoLocalSite { + return (Get-Content -Path "$global:here\Mocks\LocalSiteInfo.json" -Raw | ConvertFrom-Json) + } + + BeforeAll { + Connect-ZertoServer + } - Context "$($file.BaseName)::Function Unit Tests" { - it "Does not return anything" { - Disconnect-ZertoServer | Should -BeNullOrEmpty + It "Does not return anything" { + Disconnect-ZertoServer | Should -BeNullOrEmpty + } } } } + +Remove-Variable -Name function -Scope Global +Remove-Variable -Name here -Scope Global diff --git a/Tests/Public/Edit-ZertoVra.Tests.ps1 b/Tests/Public/Edit-ZertoVra.Tests.ps1 index 4026b3d..6e8de1e 100644 --- a/Tests/Public/Edit-ZertoVra.Tests.ps1 +++ b/Tests/Public/Edit-ZertoVra.Tests.ps1 @@ -1,187 +1,103 @@ #Requires -Modules Pester -$moduleFileName = "ZertoApiWrapper.psd1" -$here = (Split-Path -Parent $MyInvocation.MyCommand.Path) -Replace "Tests", "ZertoApiWrapper" -$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".") -$file = Get-ChildItem "$here\$sut" -$modulePath = $here -replace "Public", "" -$moduleFile = Get-ChildItem "$modulePath\$moduleFileName" -Get-Module -Name ZertoApiWrapper | Remove-Module -Force -Import-Module $moduleFile -Force +$global:here = (Split-Path -Parent $PSCommandPath) +$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0] -Describe $file.BaseName -Tag 'Unit' { +Describe $global:function -Tag 'Unit', 'Source', 'Built' { Mock -ModuleName ZertoApiWrapper Invoke-ZertoRestRequest { - return "8dcfdc8e-e5d2-4ba4-9885-f9eb57d92b14.928a122b-1763-4664-ad37-cc00bb883f2f" + Get-Content $global:here\Mocks\TaskId.txt } - Mock -ModuleName ZertoApiWrapper Get-ZertoVra { - $vraInformation = @{ - DatastoreClusterIdentifier = $null - DatastoreClusterName = $null - DatastoreIdentifier = "840f99fb-4689-2f8b-ea10-2a47a5bb00cc.Prod_Datastore" - DatastoreName = "Prod_Datastore" - HostIdentifier = "840f99fb-4689-2f8b-ea10-2a47a5bb00cc.znest82esxus-1" - HostVersion = 6.5 - IpAddress = 192.168.1.100 - Link = @{ - href = "https://192.168.1.200:7669/v1/vras/2609816293328110468" - identifier = "269816293328110468" - rel = $null - type = "VraApi" - } - MemoryInGB = 3 - NetworkIdentifier = "840f99fb-4689-2f8b-ea10-2a47a5bb00cc.network-1" - NetworkName = "Test Network" - Progress = 0 - ProtectedCounters = @{ - Vms = 0 - Volumes = 0 - Vpgs = 0 - } - RecoveryCounters = @{ - Vms = 0 - Volumes = 0 - Vpgs = 0 - } - SelfProtectedVpgs = 0 - Status = 0 - VraAlerts = @{ - VraAlertStatus = 0 - } - VraGroup = "default_group" - VraIdentifier = 269816293328110468 - VraIdentifierStr = "269816293328110468" - VraName = "VRA-znest82esxus-1" - VraNetworkDataApi = @{ - DefaultGateway = "192.168.1.1" - SubnetMask = "255.255.255.0" - VraIpAddress = "192.168.1.100" - VraIpConfigurationTypeApi = "Dhcp" - } - VraVersion = 7.0 - } - return $vraInformation + Mock -ModuleName ZertoApiWrapper Get-ZertoVra -ParameterFilter { $vraIdentifier -in @("MyVraIdentifier", "PasswordVraIdentifier") } { + Get-Content $global:here\Mocks\GetSingleVra.json -Raw | ConvertFrom-Json } - It "is valid Powershell (Has no script errors)" { - $contents = Get-Content -Path $file -ErrorAction Stop - $errors = $null - $null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors) - $errors | Should -HaveCount 0 + Mock -ModuleName ZertoApiWrapper Get-ZertoVra -ParameterFilter { $vraIdentifier -eq "DoesNotExist" } { + $null } - Context "$($File.BaseName)::Parameter Unit Tests" { + Mock -ModuleName ZertoApiWrapper Get-ZertoVra -ParameterFilter { $vraIdentifier -eq "DhcpVraIdentifier" } { + Get-Content $global:here\Mocks\GetDhcpVra.json -Raw | ConvertFrom-Json + } - It "has a mandatory String variable for the vraIdentifier" { - Get-Command $file.BaseName | Should -HaveParameter vraIdentifier -Mandatory -Type String - {Edit-ZertoVra} - } + Context "$($global:function)::Parameter Unit Tests" { - It "has a non-mandatory String variable for the Bandwidth Group" { - Get-Command $file.BaseName | Should -HaveParameter groupName -Not -Mandatory - Get-Command $file.BaseName | Should -HaveParameter groupName -Type String - } + $ParameterTestCases = @( + @{ParameterName = 'vraIdentifier'; Type = 'String'; Mandatory = $true } + @{ParameterName = 'groupName'; Type = 'String'; Mandatory = $false } + @{ParameterName = 'vraIpAddress'; Type = 'String'; Mandatory = $false } + @{ParameterName = 'defaultGateway'; Type = 'String'; Mandatory = $false } + @{ParameterName = 'subnetMask'; Type = 'String'; Mandatory = $false } + @{ParameterName = 'HostRootPassword'; Type = 'securestring'; Mandatory = $false } + ) - it "has a non-mandatory String variable for the staticIp Address" { - Get-Command $file.BaseName | Should -HaveParameter vraIpAddress -Not -Mandatory - Get-Command $file.BaseName | Should -HaveParameter vraIpAddress -Type String + It " parameter is of type" -TestCases $ParameterTestCases { + param($ParameterName, $Type, $Mandatory) + Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type } - it "has a non-mandatory String variable for the default gateway" { - Get-Command $file.BaseName | Should -HaveParameter defaultGateway -Not -Mandatory - Get-Command $file.BaseName | Should -HaveParameter defaultGateway -Type String - } + $StringTestCases = @( + @{ ParameterName = 'vraIdentifier' } + @{ ParameterName = 'groupName' } + ) - it "has a non-mandatory String variable for the subnetmask" { - Get-Command $file.BaseName | Should -HaveParameter subnetMask -Not -Mandatory - Get-Command $file.BaseName | Should -HaveParameter subnetMask -Type String + It " validates against null or empty values" -TestCases $StringTestCases { + param($ParameterName) + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1 } - it "supports WhatIf" { - Get-Command $file.BaseName | Should -HaveParameter WhatIf -Not -Mandatory + $IpAddrTestCases = @( + @{ParameterName = 'vraIpAddress' } + @{ParameterName = 'defaultGateway' } + @{ParameterName = 'subnetMask' } + ) + + It " validates string for a valid IP Address" -TestCases $IpAddrTestCases { + param($ParameterName) + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.Where{ $_ -is [ValidateScript] }.Count | Should -Be 1 + $attrs.Where{ $_ -is [ValidateScript] }.ScriptBlock | Should -Match '\$_ \-match \[IPAddress\]\$_' } - $cases = ` - @{vraIpAddress = "192.168.1.256"}, ` - @{vraIpAddress = "192.168.1"}, ` - @{vraIpAddress = "String"}, ` - @{vraIpAddress = 192.168.1}, ` - @{vraIpAddress = 192.168.1.246}, ` - @{vraIpAddress = 32}, ` - @{vraIpAddress = ""}, ` - @{vraIpAddress = $null} - It "IpAddress field require valid IP addresses as a String" -TestCases $cases { - param ( $vraIpAddress ) - {Edit-ZertoVra -vraIdentifier "MyVraIdentifier" -vraIpaddress $vraIpAddress} | Should -Throw + It "Supports 'SupportsShouldProcess'" { + Get-Command $global:function | Should -HaveParameter WhatIf + Get-Command $global:function | Should -HaveParameter Confirm + (Get-Command $global:function).ScriptBlock | Should -Match 'SupportsShouldProcess' + (Get-Command $global:function).ScriptBlock | Should -Match '\$PSCmdlet\.ShouldProcess\(.+\)' } + } - $cases = ` - @{subnetMask = "192.168.1.256"}, ` - @{subnetMask = "192.168.1"}, ` - @{subnetMask = "String"}, ` - @{subnetMask = 192.168.1}, ` - @{subnetMask = 192.168.1.246}, ` - @{subnetMask = 32}, ` - @{subnetMask = ""}, ` - @{subnetMask = $null} - It "subnetMask field require valid IP addresses as a String" -TestCases $cases { - param ( $vraIpAddress ) - {Edit-ZertoVra -vraIdentifier "MyVraIdentifier" -subnetMask $subnetMask} | Should -Throw - } + Context "$($global:function)::Function Unit Tests" { - $cases = ` - @{defaultGateway = "192.168.1.256"}, ` - @{defaultGateway = "192.168.1"}, ` - @{defaultGateway = "String"}, ` - @{defaultGateway = 192.168.1}, ` - @{defaultGateway = 192.168.1.246}, ` - @{defaultGateway = 32}, ` - @{defaultGateway = ""}, ` - @{defaultGateway = $null} - It "defaultGateway field require valid IP addresses as a String" -TestCases $cases { - param ( $vraIpAddress ) - {Edit-ZertoVra -vraIdentifier "MyVraIdentifier" -defaultGateway $defaultGateway} | Should -Throw + It "Returns a task id string" { + $results = Edit-ZertoVra -vraIdentifier "MyVraIdentifier" -groupName "MyGroup" + $results | Should not benullorempty + $results | Should -BeOfType "String" + $results | Should -BeExactly "7e79035e-fb8c-47fe-815c-12ddd41708e6.3e4cdd0d-1064-4022-921f-6265ad6d335a" } - $cases = ` - @{vraIdentifier = ""; paramName = "vraIdentifier"; paramValue = ""}, ` - @{vraIdentifier = $null; paramName = "vraIdentifier"; paramValue = ""}, ` - @{vraIdentifier = "MyVraIdentifier"; paramName = "groupName"; paramValue = ""}, ` - @{vraIdentifier = "MyVraIdentifier"; paramName = "groupName"; paramValue = $null}, ` - @{vraIdentifier = "MyVraIdentifier"; paramName = "vraIpAddress"; paramValue = ""}, ` - @{vraIdentifier = "MyVraIdentifier"; paramName = "vraIpAddress"; paramValue = $null}, ` - @{vraIdentifier = "MyVraIdentifier"; paramName = "subnetMask"; paramValue = ""}, ` - @{vraIdentifier = "MyVraIdentifier"; paramName = "subnetMask"; paramValue = $null}, ` - @{vraIdentifier = "MyVraIdentifier"; paramName = "defaultGateway"; paramValue = ""}, ` - @{vraIdentifier = "MyVraIdentifier"; paramName = "defaultGateway"; paramValue = $null} - - It " does not take empty or null" -TestCases $cases { - param($vraIdentifier, $paramValue, $paramName ) - if ([String]::IsNullOrEmpty($vraIdentifier)) { - {Edit-ZertoVra -vraIdentifier $vraIdentifier} | Should -Throw - } else { - {Edit-ZertoVra -vraIdentifier $vraIdentifier -$paramName $paramValue} | should -Throw - } + It "Throws an error when the VPG does not exist" { + { Edit-ZertoVra -vraIdentifier "DoesNotExist" -groupName "MyNewGroup" } | Should Throw "VRA with Identifier:" } - } - Context "$($File.BaseName)::Function Unit Tests" { + It "Runs when passed static IP information" { + Edit-ZertoVra -vraIdentifier "MyVraIdentifier" -vraIpAddress "192.168.1.250" -defaultGateway "192.168.1.254" -subnetMask "255.255.255.0" + } - It "Returns a string" { - $results = Edit-ZertoVra -vraIdentifier "MyVraIdentifier" -groupName "MyGroup" - $results | should not benullorempty - $results | should -BeOfType "String" - $results | Should -BeExactly "8dcfdc8e-e5d2-4ba4-9885-f9eb57d92b14.928a122b-1763-4664-ad37-cc00bb883f2f" + It "Processes a VRA with a DHCP address" { + Edit-ZertoVra -vraIdentifier "DhcpVraIdentifier" -groupName "MyNewGroup" | Should -BeExactly "7e79035e-fb8c-47fe-815c-12ddd41708e6.3e4cdd0d-1064-4022-921f-6265ad6d335a" } - it "Supports 'SupportsShouldProcess'" { - Get-Command $file.BaseName | Should -HaveParameter WhatIf - Get-Command $file.BaseName | Should -HaveParameter Confirm - $file | Should -FileContentMatch 'SupportsShouldProcess' - $file | Should -FileContentMatch '\$PSCmdlet\.ShouldProcess\(.+\)' + It "Runs with root password provided" { + $SecurePassword = 'NotARealPassword' | ConvertTo-SecureString -AsPlainText -Force + Edit-ZertoVra -vraIdentifier "PasswordVraIdentifier" -HostRootPassword $SecurePassword | Should -BeExactly "7e79035e-fb8c-47fe-815c-12ddd41708e6.3e4cdd0d-1064-4022-921f-6265ad6d335a" } } - Assert-MockCalled -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest - Assert-MockCalled -ModuleName ZertoApiWrapper -CommandName Get-ZertoVra -} \ No newline at end of file + Assert-MockCalled -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -Exactly 4 + Assert-MockCalled -ModuleName ZertoApiWrapper -CommandName Get-ZertoVra -Exactly 5 +} + +Remove-Variable -Name function -Scope Global +Remove-Variable -Name here -Scope Global diff --git a/Tests/Public/Export-ZertoVmNicSetting.Tests.ps1 b/Tests/Public/Export-ZertoVmNicSetting.Tests.ps1 new file mode 100644 index 0000000..f7ecbb1 --- /dev/null +++ b/Tests/Public/Export-ZertoVmNicSetting.Tests.ps1 @@ -0,0 +1,32 @@ +#Requires -Modules Pester +$global:here = (Split-Path -Parent $PSCommandPath) +$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0] + +Describe $global:function -Tag 'Unit', 'Source', 'Built' { + + Context "$global:function::Parameter Unit Tests" { + + $ParameterTestCases = @( + @{ParameterName = 'OutputFile'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'vpgName'; Type = 'String[]'; Mandatory = $false; Validation = 'NotNullOrEmpty' } + ) + + It " parameter is of type" -TestCases $ParameterTestCases { + param($ParameterName, $Type, $Mandatory) + Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type + } + + It " has validation set" -TestCases $ParameterTestCases { + param($ParameterName) + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1 + } + } + + Context "$global:function::Function Unit Tests" { + + } +} + +Remove-Variable -Name function -Scope Global +Remove-Variable -Name here -Scope Global diff --git a/Tests/Public/Export-ZertoVpg.Tests.ps1 b/Tests/Public/Export-ZertoVpg.Tests.ps1 index e46b59e..0e5ec77 100644 --- a/Tests/Public/Export-ZertoVpg.Tests.ps1 +++ b/Tests/Public/Export-ZertoVpg.Tests.ps1 @@ -1,53 +1,39 @@ #Requires -Modules Pester -#Region - Test Setup -$moduleFileName = "ZertoApiWrapper.psd1" -$here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper") -$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".") -$file = Get-ChildItem "$here\$sut" -$modulePath = $here -replace "Public", "" -$moduleFile = Get-ChildItem "$modulePath\$moduleFileName" -Get-Module -Name ZertoApiWrapper | Remove-Module -Force -Import-Module $moduleFile -Force -#EndRegion - -Describe $file.BaseName -Tag 'Unit' { - - It "is valid Powershell (Has no script errors)" { - $contents = Get-Content -Path $file -ErrorAction Stop - $errors = $null - $null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors) - $errors | Should -HaveCount 0 - } +$global:here = (Split-Path -Parent $PSCommandPath) +$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0] - Context "$($file.BaseName)::Parameter Unit Tests" { - it "has a mantatory string parameter for the output path" { - Get-Command $file.BaseName | Should -HaveParameter outputPath -Type String -Mandatory - } +Describe $global:function -Tag 'Unit', 'Source', 'Built' { - it "has a non-mandatory string array parameter for vpgName(s) to export" { - Get-Command $file.BaseName | Should -HaveParameter vpgName -Type String[] -Mandatory - } + Context "$global:function::Parameter Unit Tests" { - it "has a non-mandatory switch parameter to export all vpgs" { - Get-Command $file.BaseName | Should -HaveParameter allVpgs -Type Switch -Mandatory - } + $ParameterTestCases = @( + @{ParameterName = 'OutputPath'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'vpgName'; Type = 'String[]'; Mandatory = $true; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'allVpgs'; Type = 'Switch'; Mandatory = $true; Validation = $null } + ) - it "No defined vpgName or AllVpg switch should throw an error" { - {Export-ZertoVpg -outputPath "."} | Should -Throw + It " parameter is of type, with correct validation" -TestCases $ParameterTestCases { + param($ParameterName, $Type, $Mandatory, $Validation) + Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type } - it "Output path does not take null or empty string" { - {Export-ZertoVpg -outputPath "" -allVpgs} | Should -Throw - {Export-ZertoVpg -outputPath $null -allVpgs} | Should -Throw - } + It " parameter has correct validation setting" -TestCases $ParameterTestCases { + param($ParameterName, $Validation) + Switch ($Validation) { + 'NotNullOrEmpty' { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1 + } - it "Vpg Name parameter does not take null or empty string" { - {Export-ZertoVpg -outputPath "." -vpgName = ""} | Should -Throw - {Export-ZertoVpg -outputPath "." -vpgName = $null} | Should -Throw + $null { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.TypeId.Count | Should -Be 2 + } + } } } - Context "$($file.BaseName)::Function Unit Tests" { + Context "$($global:function)::Function Unit Tests" { Mock -ModuleName ZertoApiWrapper -CommandName Get-ZertoVpg { $returnObj = @{ VpgName = "HRIS" @@ -60,6 +46,10 @@ Describe $file.BaseName -Tag 'Unit' { return "1024d377-afb8-4880-82f0-96eeff413ffd" } + Mock -ModuleName ZertoApiWrapper -CommandName Remove-ZertoVpgSettingsIdentifier { + return $null + } + Mock -ModuleName ZertoApiWrapper -CommandName Get-ZertoVpgSetting { $returnObj = @{ Backup = $null @@ -213,11 +203,11 @@ Describe $file.BaseName -Tag 'Unit' { $outputPath = "TestDrive:" - it "Output path should exist" { + It "Output path should exist" { $outputPath | Should -Exist } - it "Exported JSON file should exist after function called" { + It "Exported JSON file should exist after function called" { $vpgName = "HRIS" Export-ZertoVpg -outputPath $outputPath -vpgName $vpgName $outputFile = "{0}\{1}.json" -f $outputPath, $vpgName @@ -225,11 +215,11 @@ Describe $file.BaseName -Tag 'Unit' { $outputFile | Should -Not -BeNullOrEmpty } - it "Only one file should be present in the TestDrive" { + It "Only one file should be present in the TestDrive" { (Get-ChildItem $outputPath).Count | Should -BeExactly 1 } - it "Should be valid JSON" { + It "Should be valid JSON" { $vpgName = "HRIS" Export-ZertoVpg -outputPath $outputPath -vpgName $vpgName $outputFile = "{0}\{1}.json" -f $outputPath, $vpgName @@ -247,3 +237,6 @@ Describe $file.BaseName -Tag 'Unit' { Assert-MockCalled -ModuleName ZertoApiWrapper -CommandName Get-ZertoVpgSetting } } + +Remove-Variable -Name function -Scope Global +Remove-Variable -Name here -Scope Global diff --git a/Tests/Public/Get-ZAAlert.Tests.ps1 b/Tests/Public/Get-ZAAlert.Tests.ps1 new file mode 100644 index 0000000..1a4cd6d --- /dev/null +++ b/Tests/Public/Get-ZAAlert.Tests.ps1 @@ -0,0 +1,58 @@ +#Requires -Modules Pester +$global:here = (Split-Path -Parent $PSCommandPath) +$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0] + +Describe $global:function -Tag 'Unit', 'Source', 'Built' { + + Context "$global:function::Parameter Unit Tests" { + + It "$global:function should have exactly 14 parameters defined" { + (Get-Command $global:function).Parameters.Count | Should -Be 14 + } + + $ParameterTestCases = @( + @{ParameterName = 'zOrgIdentifier'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'limitTo'; Type = 'int'; Mandatory = $false; Validation = 'Range' } + @{ParameterName = 'alertIdentifier'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' } + ) + + It " parameter is of type" -TestCases $ParameterTestCases { + param($ParameterName, $Type, $Mandatory, $Validation) + Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type + } + + It " parameter has correct validation setting" -TestCases $ParameterTestCases { + param($ParameterName, $Validation) + Switch ($Validation) { + 'NotNullOrEmpty' { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1 + } + + 'Range' { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.Where{ $_ -is [ValidateRange] }.Count | Should -Be 1 + } + + default { + $true | Should -Be $false -Because "No Validation Selected. Review test cases" + } + } + } + + It "LimitTo Parameter should have a Min value of 1" { + (Get-Command $global:function).Parameters['limitTo'].Attributes.Where{ $_ -is [ValidateRange] }.MinRange | Should -Be 1 + } + + It "LimitTo Parameter should have a Max value of 1000000" { + (Get-Command $global:function).Parameters['limitTo'].Attributes.Where{ $_ -is [ValidateRange] }.MaxRange | Should -Be 1000000 + } + } + + Context "$global:function::Parameter Functional Tests" { + + } +} + +Remove-Variable -Name here -Scope Global +Remove-Variable -Name function -Scope Global diff --git a/Tests/Public/Get-ZADatastore.Tests.ps1 b/Tests/Public/Get-ZADatastore.Tests.ps1 new file mode 100644 index 0000000..8cc0132 --- /dev/null +++ b/Tests/Public/Get-ZADatastore.Tests.ps1 @@ -0,0 +1,44 @@ +#Requires -Modules Pester +$global:here = (Split-Path -Parent $PSCommandPath) +$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0] + +Describe $global:function -Tag 'Unit', 'Source', 'Built' { + + Context "$global:function::Parameter Unit Tests" { + It "$global:function should have exactly 14 parameters defined" { + (Get-Command $global:function).Parameters.Count | Should -Be 14 + } + + $ParameterTestCases = @( + @{ParameterName = 'datastoreIdentifier'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'clusterIdentifier'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'siteIdentifier'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' } + ) + + It " parameter is of type" -TestCases $ParameterTestCases { + param($ParameterName, $Type, $Mandatory, $Validation) + Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type + } + + It " parameter has correct validation setting" -TestCases $ParameterTestCases { + param($ParameterName, $Validation) + Switch ($Validation) { + 'NotNullOrEmpty' { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1 + } + + default { + $true | Should -Be $false -Because "No Validation Selected. Review test cases" + } + } + } + } + + Context "$global:function::Parameter Functional Tests" { + + } +} + +Remove-Variable -Name here -Scope Global +Remove-Variable -Name function -Scope Global diff --git a/Tests/Public/Get-ZAEvent.Tests.ps1 b/Tests/Public/Get-ZAEvent.Tests.ps1 new file mode 100644 index 0000000..61bcfd8 --- /dev/null +++ b/Tests/Public/Get-ZAEvent.Tests.ps1 @@ -0,0 +1,77 @@ +#Requires -Modules Pester +$global:here = (Split-Path -Parent $PSCommandPath) +$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0] + +Describe $global:function -Tag 'Unit', 'Source', 'Built' { + + Context "$global:function::Parameter Unit Tests" { + + It "$global:function should have exactly 16 parameters defined" { + (Get-Command $global:function).Parameters.Count | Should -Be 16 + } + + $ParameterTestCases = @( + @{ParameterName = 'zOrgIdentifier'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'limitTo'; Type = 'int'; Mandatory = $false; Validation = 'Range' } + @{ParameterName = 'category'; Type = 'String'; Mandatory = $false; Validation = 'Set' } + @{ParameterName = 'startDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'endDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } + ) + + It " parameter is of type" -TestCases $ParameterTestCases { + param($ParameterName, $Type, $Mandatory, $Validation) + Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type + } + + It " parameter has correct validation setting" -TestCases $ParameterTestCases { + param($ParameterName, $Validation) + Switch ($Validation) { + 'NotNullOrEmpty' { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1 + } + + 'Range' { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.Where{ $_ -is [ValidateRange] }.Count | Should -Be 1 + } + + 'Set' { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.Where{ $_ -is [ValidateSet] }.Count | Should -Be 1 + } + + default { + $true | Should -Be $false -Because "No Validation Selected. Review test cases" + } + } + } + + It "LimitTo Parameter should have a Min value of 1" { + (Get-Command $global:function).Parameters['limitTo'].Attributes.Where{ $_ -is [ValidateRange] }.MinRange | Should -Be 1 + } + + It "LimitTo Parameter should have a Max value of 1000000" { + (Get-Command $global:function).Parameters['limitTo'].Attributes.Where{ $_ -is [ValidateRange] }.MaxRange | Should -Be 1000000 + } + + It "Category parameter should only have 2 options" { + (Get-Command $global:function).Parameters['category'].Attributes.Where{ $_ -is [ValidateSet] }.ValidValues.Count | Should -Be 2 + } + + It "Category parameter should take 'events'" { + (Get-Command $global:function).Parameters['category'].Attributes.Where{ $_ -is [ValidateSet] }.ValidValues | Should -Contain 'events' + } + + It "Category parameter should take 'alertsHistory'" { + (Get-Command $global:function).Parameters['category'].Attributes.Where{ $_ -is [ValidateSet] }.ValidValues | Should -Contain 'alertsHistory' + } + } + + Context "$global:function::Parameter Functional Tests" { + + } +} + +Remove-Variable -Name here -Scope Global +Remove-Variable -Name function -Scope Global diff --git a/Tests/Public/Get-ZAJournalAverageHistory.Tests.ps1 b/Tests/Public/Get-ZAJournalAverageHistory.Tests.ps1 new file mode 100644 index 0000000..4ab1f59 --- /dev/null +++ b/Tests/Public/Get-ZAJournalAverageHistory.Tests.ps1 @@ -0,0 +1,59 @@ +#Requires -Modules Pester +$global:here = (Split-Path -Parent $PSCommandPath) +$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0] + +Describe $global:function -Tag 'Unit', 'Source', 'Built' { + + Context "$global:function::Parameter Unit Tests" { + + It "$global:function should have exactly 15 parameters defined" { + (Get-Command $global:function).Parameters.Count | Should -Be 15 + } + + $ParameterTestCases = @( + @{ParameterName = 'vpgIdentifier'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'startDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'endDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'interval'; Type = 'Int32'; Mandatory = $false; Validation = 'Range' } + ) + + It " parameter is of type" -TestCases $ParameterTestCases { + param($ParameterName, $Type, $Mandatory, $Validation) + Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type + } + + It " parameter has correct validation setting" -TestCases $ParameterTestCases { + param($ParameterName, $Validation) + Switch ($Validation) { + 'NotNullOrEmpty' { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1 + } + + 'Range' { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.Where{ $_ -is [ValidateRange] }.Count | Should -Be 1 + } + + default { + $true | Should -Be $false -Because "No Validation Selected. Review test cases" + } + } + } + + It "Interval Parameter should have a Min value of 60" { + (Get-Command $global:function).Parameters['Interval'].Attributes.Where{ $_ -is [ValidateRange] }.MinRange | Should -Be 60 + } + + It "Interval Parameter should have a Max value of 2678400" { + (Get-Command $global:function).Parameters['Interval'].Attributes.Where{ $_ -is [ValidateRange] }.MaxRange | Should -Be 2678400 + } + } + + Context "$global:function::Parameter Functional Tests" { + + } +} + +Remove-Variable -Name here -Scope Global +Remove-Variable -Name function -Scope Global diff --git a/Tests/Public/Get-ZAJournalAverageSize.Tests.ps1 b/Tests/Public/Get-ZAJournalAverageSize.Tests.ps1 new file mode 100644 index 0000000..4ab0358 --- /dev/null +++ b/Tests/Public/Get-ZAJournalAverageSize.Tests.ps1 @@ -0,0 +1,58 @@ +#Requires -Modules Pester +$global:here = (Split-Path -Parent $PSCommandPath) +$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0] + +Describe $global:function -Tag 'Unit', 'Source', 'Built' { + + Context "$global:function::Parameter Unit Tests" { + It "$global:function should have exactly 15 parameters defined" { + (Get-Command $global:function).Parameters.Count | Should -Be 15 + } + + $ParameterTestCases = @( + @{ParameterName = 'vpgIdentifier'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'startDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'endDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'interval'; Type = 'Int32'; Mandatory = $false; Validation = 'Range' } + ) + + It " parameter is of type" -TestCases $ParameterTestCases { + param($ParameterName, $Type, $Mandatory, $Validation) + Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type + } + + It " parameter has correct validation setting" -TestCases $ParameterTestCases { + param($ParameterName, $Validation) + Switch ($Validation) { + 'NotNullOrEmpty' { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1 + } + + 'Range' { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.Where{ $_ -is [ValidateRange] }.Count | Should -Be 1 + } + + default { + $true | Should -Be $false -Because "No Validation Selected. Review test cases" + } + } + } + + It "Interval Parameter should have a Min value of 60" { + (Get-Command $global:function).Parameters['Interval'].Attributes.Where{ $_ -is [ValidateRange] }.MinRange | Should -Be 60 + } + + It "Interval Parameter should have a Max value of 2678400" { + (Get-Command $global:function).Parameters['Interval'].Attributes.Where{ $_ -is [ValidateRange] }.MaxRange | Should -Be 2678400 + } + } + + Context "$global:function::Parameter Functional Tests" { + + } +} + +Remove-Variable -Name here -Scope Global +Remove-Variable -Name function -Scope Global diff --git a/Tests/Public/Get-ZAJournalBreach.Tests.ps1 b/Tests/Public/Get-ZAJournalBreach.Tests.ps1 new file mode 100644 index 0000000..94b7a9e --- /dev/null +++ b/Tests/Public/Get-ZAJournalBreach.Tests.ps1 @@ -0,0 +1,44 @@ +#Requires -Modules Pester +$global:here = (Split-Path -Parent $PSCommandPath) +$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0] + +Describe $global:function -Tag 'Unit', 'Source', 'Built' { + + Context "$global:function::Parameter Unit Tests" { + It "$global:function should have exactly 14 parameters defined" { + (Get-Command $global:function).Parameters.Count | Should -Be 14 + } + + $ParameterTestCases = @( + @{ParameterName = 'vpgIdentifier'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'startDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'endDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } + ) + + It " parameter is of type" -TestCases $ParameterTestCases { + param($ParameterName, $Type, $Mandatory, $Validation) + Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type + } + + It " parameter has correct validation setting" -TestCases $ParameterTestCases { + param($ParameterName, $Validation) + Switch ($Validation) { + 'NotNullOrEmpty' { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1 + } + + default { + $true | Should -Be $false -Because "No Validation Selected. Review test cases" + } + } + } + } + + Context "$global:function::Parameter Functional Tests" { + + } +} + +Remove-Variable -Name here -Scope Global +Remove-Variable -Name function -Scope Global diff --git a/Tests/Public/Get-ZAJournalHistoryStat.Tests.ps1 b/Tests/Public/Get-ZAJournalHistoryStat.Tests.ps1 new file mode 100644 index 0000000..94b7a9e --- /dev/null +++ b/Tests/Public/Get-ZAJournalHistoryStat.Tests.ps1 @@ -0,0 +1,44 @@ +#Requires -Modules Pester +$global:here = (Split-Path -Parent $PSCommandPath) +$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0] + +Describe $global:function -Tag 'Unit', 'Source', 'Built' { + + Context "$global:function::Parameter Unit Tests" { + It "$global:function should have exactly 14 parameters defined" { + (Get-Command $global:function).Parameters.Count | Should -Be 14 + } + + $ParameterTestCases = @( + @{ParameterName = 'vpgIdentifier'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'startDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'endDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } + ) + + It " parameter is of type" -TestCases $ParameterTestCases { + param($ParameterName, $Type, $Mandatory, $Validation) + Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type + } + + It " parameter has correct validation setting" -TestCases $ParameterTestCases { + param($ParameterName, $Validation) + Switch ($Validation) { + 'NotNullOrEmpty' { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1 + } + + default { + $true | Should -Be $false -Because "No Validation Selected. Review test cases" + } + } + } + } + + Context "$global:function::Parameter Functional Tests" { + + } +} + +Remove-Variable -Name here -Scope Global +Remove-Variable -Name function -Scope Global diff --git a/Tests/Public/Get-ZAJournalSiteAverageHistory.Tests.ps1 b/Tests/Public/Get-ZAJournalSiteAverageHistory.Tests.ps1 new file mode 100644 index 0000000..b91ec04 --- /dev/null +++ b/Tests/Public/Get-ZAJournalSiteAverageHistory.Tests.ps1 @@ -0,0 +1,58 @@ +#Requires -Modules Pester +$global:here = (Split-Path -Parent $PSCommandPath) +$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0] + +Describe $global:function -Tag 'Unit', 'Source', 'Built' { + + Context "$global:function::Parameter Unit Tests" { + It "$global:function should have exactly 15 parameters defined" { + (Get-Command $global:function).Parameters.Count | Should -Be 15 + } + + $ParameterTestCases = @( + @{ParameterName = 'recoverySiteIdentifier'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'startDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'endDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'interval'; Type = 'Int32'; Mandatory = $false; Validation = 'Range' } + ) + + It " parameter is of type" -TestCases $ParameterTestCases { + param($ParameterName, $Type, $Mandatory, $Validation) + Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type + } + + It " parameter has correct validation setting" -TestCases $ParameterTestCases { + param($ParameterName, $Validation) + Switch ($Validation) { + 'NotNullOrEmpty' { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1 + } + + 'Range' { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.Where{ $_ -is [ValidateRange] }.Count | Should -Be 1 + } + + default { + $true | Should -Be $false -Because "No Validation Selected. Review test cases" + } + } + } + + It "Interval Parameter should have a Min value of 60" { + (Get-Command $global:function).Parameters['Interval'].Attributes.Where{ $_ -is [ValidateRange] }.MinRange | Should -Be 60 + } + + It "Interval Parameter should have a Max value of 2678400" { + (Get-Command $global:function).Parameters['Interval'].Attributes.Where{ $_ -is [ValidateRange] }.MaxRange | Should -Be 2678400 + } + } + + Context "$global:function::Parameter Functional Tests" { + + } +} + +Remove-Variable -Name here -Scope Global +Remove-Variable -Name function -Scope Global diff --git a/Tests/Public/Get-ZAJournalSiteAverageSize.Tests.ps1 b/Tests/Public/Get-ZAJournalSiteAverageSize.Tests.ps1 new file mode 100644 index 0000000..b91ec04 --- /dev/null +++ b/Tests/Public/Get-ZAJournalSiteAverageSize.Tests.ps1 @@ -0,0 +1,58 @@ +#Requires -Modules Pester +$global:here = (Split-Path -Parent $PSCommandPath) +$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0] + +Describe $global:function -Tag 'Unit', 'Source', 'Built' { + + Context "$global:function::Parameter Unit Tests" { + It "$global:function should have exactly 15 parameters defined" { + (Get-Command $global:function).Parameters.Count | Should -Be 15 + } + + $ParameterTestCases = @( + @{ParameterName = 'recoverySiteIdentifier'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'startDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'endDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'interval'; Type = 'Int32'; Mandatory = $false; Validation = 'Range' } + ) + + It " parameter is of type" -TestCases $ParameterTestCases { + param($ParameterName, $Type, $Mandatory, $Validation) + Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type + } + + It " parameter has correct validation setting" -TestCases $ParameterTestCases { + param($ParameterName, $Validation) + Switch ($Validation) { + 'NotNullOrEmpty' { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1 + } + + 'Range' { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.Where{ $_ -is [ValidateRange] }.Count | Should -Be 1 + } + + default { + $true | Should -Be $false -Because "No Validation Selected. Review test cases" + } + } + } + + It "Interval Parameter should have a Min value of 60" { + (Get-Command $global:function).Parameters['Interval'].Attributes.Where{ $_ -is [ValidateRange] }.MinRange | Should -Be 60 + } + + It "Interval Parameter should have a Max value of 2678400" { + (Get-Command $global:function).Parameters['Interval'].Attributes.Where{ $_ -is [ValidateRange] }.MaxRange | Should -Be 2678400 + } + } + + Context "$global:function::Parameter Functional Tests" { + + } +} + +Remove-Variable -Name here -Scope Global +Remove-Variable -Name function -Scope Global diff --git a/Tests/Public/Get-ZAJournalSiteHistoryStat.Tests.ps1 b/Tests/Public/Get-ZAJournalSiteHistoryStat.Tests.ps1 new file mode 100644 index 0000000..b91ec04 --- /dev/null +++ b/Tests/Public/Get-ZAJournalSiteHistoryStat.Tests.ps1 @@ -0,0 +1,58 @@ +#Requires -Modules Pester +$global:here = (Split-Path -Parent $PSCommandPath) +$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0] + +Describe $global:function -Tag 'Unit', 'Source', 'Built' { + + Context "$global:function::Parameter Unit Tests" { + It "$global:function should have exactly 15 parameters defined" { + (Get-Command $global:function).Parameters.Count | Should -Be 15 + } + + $ParameterTestCases = @( + @{ParameterName = 'recoverySiteIdentifier'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'startDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'endDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'interval'; Type = 'Int32'; Mandatory = $false; Validation = 'Range' } + ) + + It " parameter is of type" -TestCases $ParameterTestCases { + param($ParameterName, $Type, $Mandatory, $Validation) + Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type + } + + It " parameter has correct validation setting" -TestCases $ParameterTestCases { + param($ParameterName, $Validation) + Switch ($Validation) { + 'NotNullOrEmpty' { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1 + } + + 'Range' { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.Where{ $_ -is [ValidateRange] }.Count | Should -Be 1 + } + + default { + $true | Should -Be $false -Because "No Validation Selected. Review test cases" + } + } + } + + It "Interval Parameter should have a Min value of 60" { + (Get-Command $global:function).Parameters['Interval'].Attributes.Where{ $_ -is [ValidateRange] }.MinRange | Should -Be 60 + } + + It "Interval Parameter should have a Max value of 2678400" { + (Get-Command $global:function).Parameters['Interval'].Attributes.Where{ $_ -is [ValidateRange] }.MaxRange | Should -Be 2678400 + } + } + + Context "$global:function::Parameter Functional Tests" { + + } +} + +Remove-Variable -Name here -Scope Global +Remove-Variable -Name function -Scope Global diff --git a/Tests/Public/Get-ZAJournalSiteHistorySummary.Tests.ps1 b/Tests/Public/Get-ZAJournalSiteHistorySummary.Tests.ps1 new file mode 100644 index 0000000..b91ec04 --- /dev/null +++ b/Tests/Public/Get-ZAJournalSiteHistorySummary.Tests.ps1 @@ -0,0 +1,58 @@ +#Requires -Modules Pester +$global:here = (Split-Path -Parent $PSCommandPath) +$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0] + +Describe $global:function -Tag 'Unit', 'Source', 'Built' { + + Context "$global:function::Parameter Unit Tests" { + It "$global:function should have exactly 15 parameters defined" { + (Get-Command $global:function).Parameters.Count | Should -Be 15 + } + + $ParameterTestCases = @( + @{ParameterName = 'recoverySiteIdentifier'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'startDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'endDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'interval'; Type = 'Int32'; Mandatory = $false; Validation = 'Range' } + ) + + It " parameter is of type" -TestCases $ParameterTestCases { + param($ParameterName, $Type, $Mandatory, $Validation) + Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type + } + + It " parameter has correct validation setting" -TestCases $ParameterTestCases { + param($ParameterName, $Validation) + Switch ($Validation) { + 'NotNullOrEmpty' { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1 + } + + 'Range' { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.Where{ $_ -is [ValidateRange] }.Count | Should -Be 1 + } + + default { + $true | Should -Be $false -Because "No Validation Selected. Review test cases" + } + } + } + + It "Interval Parameter should have a Min value of 60" { + (Get-Command $global:function).Parameters['Interval'].Attributes.Where{ $_ -is [ValidateRange] }.MinRange | Should -Be 60 + } + + It "Interval Parameter should have a Max value of 2678400" { + (Get-Command $global:function).Parameters['Interval'].Attributes.Where{ $_ -is [ValidateRange] }.MaxRange | Should -Be 2678400 + } + } + + Context "$global:function::Parameter Functional Tests" { + + } +} + +Remove-Variable -Name here -Scope Global +Remove-Variable -Name function -Scope Global diff --git a/Tests/Public/Get-ZAJournalSiteSizeStat.Tests.ps1 b/Tests/Public/Get-ZAJournalSiteSizeStat.Tests.ps1 new file mode 100644 index 0000000..b91ec04 --- /dev/null +++ b/Tests/Public/Get-ZAJournalSiteSizeStat.Tests.ps1 @@ -0,0 +1,58 @@ +#Requires -Modules Pester +$global:here = (Split-Path -Parent $PSCommandPath) +$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0] + +Describe $global:function -Tag 'Unit', 'Source', 'Built' { + + Context "$global:function::Parameter Unit Tests" { + It "$global:function should have exactly 15 parameters defined" { + (Get-Command $global:function).Parameters.Count | Should -Be 15 + } + + $ParameterTestCases = @( + @{ParameterName = 'recoverySiteIdentifier'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'startDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'endDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'interval'; Type = 'Int32'; Mandatory = $false; Validation = 'Range' } + ) + + It " parameter is of type" -TestCases $ParameterTestCases { + param($ParameterName, $Type, $Mandatory, $Validation) + Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type + } + + It " parameter has correct validation setting" -TestCases $ParameterTestCases { + param($ParameterName, $Validation) + Switch ($Validation) { + 'NotNullOrEmpty' { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1 + } + + 'Range' { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.Where{ $_ -is [ValidateRange] }.Count | Should -Be 1 + } + + default { + $true | Should -Be $false -Because "No Validation Selected. Review test cases" + } + } + } + + It "Interval Parameter should have a Min value of 60" { + (Get-Command $global:function).Parameters['Interval'].Attributes.Where{ $_ -is [ValidateRange] }.MinRange | Should -Be 60 + } + + It "Interval Parameter should have a Max value of 2678400" { + (Get-Command $global:function).Parameters['Interval'].Attributes.Where{ $_ -is [ValidateRange] }.MaxRange | Should -Be 2678400 + } + } + + Context "$global:function::Parameter Functional Tests" { + + } +} + +Remove-Variable -Name here -Scope Global +Remove-Variable -Name function -Scope Global diff --git a/Tests/Public/Get-ZAJournalStatusProportion.Tests.ps1 b/Tests/Public/Get-ZAJournalStatusProportion.Tests.ps1 new file mode 100644 index 0000000..94b7a9e --- /dev/null +++ b/Tests/Public/Get-ZAJournalStatusProportion.Tests.ps1 @@ -0,0 +1,44 @@ +#Requires -Modules Pester +$global:here = (Split-Path -Parent $PSCommandPath) +$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0] + +Describe $global:function -Tag 'Unit', 'Source', 'Built' { + + Context "$global:function::Parameter Unit Tests" { + It "$global:function should have exactly 14 parameters defined" { + (Get-Command $global:function).Parameters.Count | Should -Be 14 + } + + $ParameterTestCases = @( + @{ParameterName = 'vpgIdentifier'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'startDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'endDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } + ) + + It " parameter is of type" -TestCases $ParameterTestCases { + param($ParameterName, $Type, $Mandatory, $Validation) + Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type + } + + It " parameter has correct validation setting" -TestCases $ParameterTestCases { + param($ParameterName, $Validation) + Switch ($Validation) { + 'NotNullOrEmpty' { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1 + } + + default { + $true | Should -Be $false -Because "No Validation Selected. Review test cases" + } + } + } + } + + Context "$global:function::Parameter Functional Tests" { + + } +} + +Remove-Variable -Name here -Scope Global +Remove-Variable -Name function -Scope Global diff --git a/Tests/Public/Get-ZAJournalStorageStat.Tests.ps1 b/Tests/Public/Get-ZAJournalStorageStat.Tests.ps1 new file mode 100644 index 0000000..94b7a9e --- /dev/null +++ b/Tests/Public/Get-ZAJournalStorageStat.Tests.ps1 @@ -0,0 +1,44 @@ +#Requires -Modules Pester +$global:here = (Split-Path -Parent $PSCommandPath) +$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0] + +Describe $global:function -Tag 'Unit', 'Source', 'Built' { + + Context "$global:function::Parameter Unit Tests" { + It "$global:function should have exactly 14 parameters defined" { + (Get-Command $global:function).Parameters.Count | Should -Be 14 + } + + $ParameterTestCases = @( + @{ParameterName = 'vpgIdentifier'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'startDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'endDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } + ) + + It " parameter is of type" -TestCases $ParameterTestCases { + param($ParameterName, $Type, $Mandatory, $Validation) + Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type + } + + It " parameter has correct validation setting" -TestCases $ParameterTestCases { + param($ParameterName, $Validation) + Switch ($Validation) { + 'NotNullOrEmpty' { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1 + } + + default { + $true | Should -Be $false -Because "No Validation Selected. Review test cases" + } + } + } + } + + Context "$global:function::Parameter Functional Tests" { + + } +} + +Remove-Variable -Name here -Scope Global +Remove-Variable -Name function -Scope Global diff --git a/Tests/Public/Get-ZAJournalSummary.Tests.ps1 b/Tests/Public/Get-ZAJournalSummary.Tests.ps1 new file mode 100644 index 0000000..94b7a9e --- /dev/null +++ b/Tests/Public/Get-ZAJournalSummary.Tests.ps1 @@ -0,0 +1,44 @@ +#Requires -Modules Pester +$global:here = (Split-Path -Parent $PSCommandPath) +$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0] + +Describe $global:function -Tag 'Unit', 'Source', 'Built' { + + Context "$global:function::Parameter Unit Tests" { + It "$global:function should have exactly 14 parameters defined" { + (Get-Command $global:function).Parameters.Count | Should -Be 14 + } + + $ParameterTestCases = @( + @{ParameterName = 'vpgIdentifier'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'startDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'endDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } + ) + + It " parameter is of type" -TestCases $ParameterTestCases { + param($ParameterName, $Type, $Mandatory, $Validation) + Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type + } + + It " parameter has correct validation setting" -TestCases $ParameterTestCases { + param($ParameterName, $Validation) + Switch ($Validation) { + 'NotNullOrEmpty' { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1 + } + + default { + $true | Should -Be $false -Because "No Validation Selected. Review test cases" + } + } + } + } + + Context "$global:function::Parameter Functional Tests" { + + } +} + +Remove-Variable -Name here -Scope Global +Remove-Variable -Name function -Scope Global diff --git a/Tests/Public/Get-ZALicense.Tests.ps1 b/Tests/Public/Get-ZALicense.Tests.ps1 new file mode 100644 index 0000000..e3e16ee --- /dev/null +++ b/Tests/Public/Get-ZALicense.Tests.ps1 @@ -0,0 +1,19 @@ +#Requires -Modules Pester +$global:here = (Split-Path -Parent $PSCommandPath) +$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0] + +Describe $global:function -Tag 'Unit', 'Source', 'Built' { + + Context "$global:function::Parameter Unit Tests" { + It "$global:function should have exactly 11 parameters defined" { + (Get-Command $global:function).Parameters.Count | Should -Be 11 + } + } + + Context "$global:function::Parameter Functional Tests" { + + } +} + +Remove-Variable -Name here -Scope Global +Remove-Variable -Name function -Scope Global diff --git a/Tests/Public/Get-ZAMonitoring.Tests.ps1 b/Tests/Public/Get-ZAMonitoring.Tests.ps1 new file mode 100644 index 0000000..1ced87b --- /dev/null +++ b/Tests/Public/Get-ZAMonitoring.Tests.ps1 @@ -0,0 +1,24 @@ +#Requires -Modules Pester +$global:here = (Split-Path -Parent $PSCommandPath) +$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0] + +Describe $global:function -Tag 'Unit', 'Source', 'Built' { + + Context "$global:function::Parameter Unit Tests" { + It "$global:function should have exactly 12 parameters defined" { + (Get-Command $global:function).Parameters.Count | Should -Be 12 + } + + It "$global:function has a non-mandatory string parameter for the zOrgIdentifier" { + Get-Command $global:function | Should -HaveParameter zOrgIdentifier -Type String + Get-Command $global:function | Should -HaveParameter zOrgIdentifier -not -Mandatory + } + } + + Context "$global:function::Parameter Functional Tests" { + + } +} + +Remove-Variable -Name here -Scope Global +Remove-Variable -Name function -Scope Global diff --git a/Tests/Public/Get-ZANetworkSiteAverageIOPS.Tests.ps1 b/Tests/Public/Get-ZANetworkSiteAverageIOPS.Tests.ps1 new file mode 100644 index 0000000..be1237c --- /dev/null +++ b/Tests/Public/Get-ZANetworkSiteAverageIOPS.Tests.ps1 @@ -0,0 +1,60 @@ +#Requires -Modules Pester +$global:here = (Split-Path -Parent $PSCommandPath) +$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0] + +Describe $global:function -Tag 'Unit', 'Source', 'Built' { + + Context "$global:function::Parameter Unit Tests" { + It "$global:function should have exactly 17 parameters defined" { + (Get-Command $global:function).Parameters.Count | Should -Be 17 + } + + $ParameterTestCases = @( + @{ParameterName = 'protectedSiteIdentifier'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'recoverySiteIdentifier'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'startDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'endDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'zOrgIdentifier'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'interval'; Type = 'Int32'; Mandatory = $false; Validation = 'Range' } + ) + + It " parameter is of type" -TestCases $ParameterTestCases { + param($ParameterName, $Type, $Mandatory, $Validation) + Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type + } + + It " parameter has correct validation setting" -TestCases $ParameterTestCases { + param($ParameterName, $Validation) + Switch ($Validation) { + 'NotNullOrEmpty' { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1 + } + + 'Range' { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.Where{ $_ -is [ValidateRange] }.Count | Should -Be 1 + } + + default { + $true | Should -Be $false -Because "No Validation Selected. Review test cases" + } + } + } + + It "Interval Parameter should have a Min value of 60" { + (Get-Command $global:function).Parameters['Interval'].Attributes.Where{ $_ -is [ValidateRange] }.MinRange | Should -Be 60 + } + + It "Interval Parameter should have a Max value of 2678400" { + (Get-Command $global:function).Parameters['Interval'].Attributes.Where{ $_ -is [ValidateRange] }.MaxRange | Should -Be 2678400 + } + } + + Context "$global:function::Parameter Functional Tests" { + + } +} + +Remove-Variable -Name here -Scope Global +Remove-Variable -Name function -Scope Global diff --git a/Tests/Public/Get-ZANetworkSiteAveragePerformance.Tests.ps1 b/Tests/Public/Get-ZANetworkSiteAveragePerformance.Tests.ps1 new file mode 100644 index 0000000..be1237c --- /dev/null +++ b/Tests/Public/Get-ZANetworkSiteAveragePerformance.Tests.ps1 @@ -0,0 +1,60 @@ +#Requires -Modules Pester +$global:here = (Split-Path -Parent $PSCommandPath) +$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0] + +Describe $global:function -Tag 'Unit', 'Source', 'Built' { + + Context "$global:function::Parameter Unit Tests" { + It "$global:function should have exactly 17 parameters defined" { + (Get-Command $global:function).Parameters.Count | Should -Be 17 + } + + $ParameterTestCases = @( + @{ParameterName = 'protectedSiteIdentifier'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'recoverySiteIdentifier'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'startDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'endDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'zOrgIdentifier'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'interval'; Type = 'Int32'; Mandatory = $false; Validation = 'Range' } + ) + + It " parameter is of type" -TestCases $ParameterTestCases { + param($ParameterName, $Type, $Mandatory, $Validation) + Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type + } + + It " parameter has correct validation setting" -TestCases $ParameterTestCases { + param($ParameterName, $Validation) + Switch ($Validation) { + 'NotNullOrEmpty' { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1 + } + + 'Range' { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.Where{ $_ -is [ValidateRange] }.Count | Should -Be 1 + } + + default { + $true | Should -Be $false -Because "No Validation Selected. Review test cases" + } + } + } + + It "Interval Parameter should have a Min value of 60" { + (Get-Command $global:function).Parameters['Interval'].Attributes.Where{ $_ -is [ValidateRange] }.MinRange | Should -Be 60 + } + + It "Interval Parameter should have a Max value of 2678400" { + (Get-Command $global:function).Parameters['Interval'].Attributes.Where{ $_ -is [ValidateRange] }.MaxRange | Should -Be 2678400 + } + } + + Context "$global:function::Parameter Functional Tests" { + + } +} + +Remove-Variable -Name here -Scope Global +Remove-Variable -Name function -Scope Global diff --git a/Tests/Public/Get-ZANetworkSiteStat.Tests.ps1 b/Tests/Public/Get-ZANetworkSiteStat.Tests.ps1 new file mode 100644 index 0000000..0d7b26a --- /dev/null +++ b/Tests/Public/Get-ZANetworkSiteStat.Tests.ps1 @@ -0,0 +1,51 @@ +#Requires -Modules Pester +$global:here = (Split-Path -Parent $PSCommandPath) +$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0] + +Describe $global:function -Tag 'Unit', 'Source', 'Built' { + + Context "$global:function::Parameter Unit Tests" { + It "$global:function should have exactly 16 parameters defined" { + (Get-Command $global:function).Parameters.Count | Should -Be 16 + } + + $ParameterTestCases = @( + @{ParameterName = 'protectedSiteIdentifier'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'recoverySiteIdentifier'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'startDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'endDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'zOrgIdentifier'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } + ) + + It " parameter is of type" -TestCases $ParameterTestCases { + param($ParameterName, $Type, $Mandatory, $Validation) + Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type + } + + It " parameter has correct validation setting" -TestCases $ParameterTestCases { + param($ParameterName, $Validation) + Switch ($Validation) { + 'NotNullOrEmpty' { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1 + } + + 'Range' { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.Where{ $_ -is [ValidateRange] }.Count | Should -Be 1 + } + + default { + $true | Should -Be $false -Because "No Validation Selected. Review test cases" + } + } + } + } + + Context "$global:function::Parameter Functional Tests" { + + } +} + +Remove-Variable -Name here -Scope Global +Remove-Variable -Name function -Scope Global diff --git a/Tests/Public/Get-ZANetworkSiteSummary.Tests.ps1 b/Tests/Public/Get-ZANetworkSiteSummary.Tests.ps1 new file mode 100644 index 0000000..0d7b26a --- /dev/null +++ b/Tests/Public/Get-ZANetworkSiteSummary.Tests.ps1 @@ -0,0 +1,51 @@ +#Requires -Modules Pester +$global:here = (Split-Path -Parent $PSCommandPath) +$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0] + +Describe $global:function -Tag 'Unit', 'Source', 'Built' { + + Context "$global:function::Parameter Unit Tests" { + It "$global:function should have exactly 16 parameters defined" { + (Get-Command $global:function).Parameters.Count | Should -Be 16 + } + + $ParameterTestCases = @( + @{ParameterName = 'protectedSiteIdentifier'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'recoverySiteIdentifier'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'startDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'endDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'zOrgIdentifier'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } + ) + + It " parameter is of type" -TestCases $ParameterTestCases { + param($ParameterName, $Type, $Mandatory, $Validation) + Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type + } + + It " parameter has correct validation setting" -TestCases $ParameterTestCases { + param($ParameterName, $Validation) + Switch ($Validation) { + 'NotNullOrEmpty' { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1 + } + + 'Range' { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.Where{ $_ -is [ValidateRange] }.Count | Should -Be 1 + } + + default { + $true | Should -Be $false -Because "No Validation Selected. Review test cases" + } + } + } + } + + Context "$global:function::Parameter Functional Tests" { + + } +} + +Remove-Variable -Name here -Scope Global +Remove-Variable -Name function -Scope Global diff --git a/Tests/Public/Get-ZANetworkVpgAverageIOPS.Tests.ps1 b/Tests/Public/Get-ZANetworkVpgAverageIOPS.Tests.ps1 new file mode 100644 index 0000000..4ab0358 --- /dev/null +++ b/Tests/Public/Get-ZANetworkVpgAverageIOPS.Tests.ps1 @@ -0,0 +1,58 @@ +#Requires -Modules Pester +$global:here = (Split-Path -Parent $PSCommandPath) +$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0] + +Describe $global:function -Tag 'Unit', 'Source', 'Built' { + + Context "$global:function::Parameter Unit Tests" { + It "$global:function should have exactly 15 parameters defined" { + (Get-Command $global:function).Parameters.Count | Should -Be 15 + } + + $ParameterTestCases = @( + @{ParameterName = 'vpgIdentifier'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'startDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'endDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'interval'; Type = 'Int32'; Mandatory = $false; Validation = 'Range' } + ) + + It " parameter is of type" -TestCases $ParameterTestCases { + param($ParameterName, $Type, $Mandatory, $Validation) + Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type + } + + It " parameter has correct validation setting" -TestCases $ParameterTestCases { + param($ParameterName, $Validation) + Switch ($Validation) { + 'NotNullOrEmpty' { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1 + } + + 'Range' { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.Where{ $_ -is [ValidateRange] }.Count | Should -Be 1 + } + + default { + $true | Should -Be $false -Because "No Validation Selected. Review test cases" + } + } + } + + It "Interval Parameter should have a Min value of 60" { + (Get-Command $global:function).Parameters['Interval'].Attributes.Where{ $_ -is [ValidateRange] }.MinRange | Should -Be 60 + } + + It "Interval Parameter should have a Max value of 2678400" { + (Get-Command $global:function).Parameters['Interval'].Attributes.Where{ $_ -is [ValidateRange] }.MaxRange | Should -Be 2678400 + } + } + + Context "$global:function::Parameter Functional Tests" { + + } +} + +Remove-Variable -Name here -Scope Global +Remove-Variable -Name function -Scope Global diff --git a/Tests/Public/Get-ZANetworkVpgAveragePerformance.Tests.ps1 b/Tests/Public/Get-ZANetworkVpgAveragePerformance.Tests.ps1 new file mode 100644 index 0000000..4ab0358 --- /dev/null +++ b/Tests/Public/Get-ZANetworkVpgAveragePerformance.Tests.ps1 @@ -0,0 +1,58 @@ +#Requires -Modules Pester +$global:here = (Split-Path -Parent $PSCommandPath) +$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0] + +Describe $global:function -Tag 'Unit', 'Source', 'Built' { + + Context "$global:function::Parameter Unit Tests" { + It "$global:function should have exactly 15 parameters defined" { + (Get-Command $global:function).Parameters.Count | Should -Be 15 + } + + $ParameterTestCases = @( + @{ParameterName = 'vpgIdentifier'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'startDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'endDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'interval'; Type = 'Int32'; Mandatory = $false; Validation = 'Range' } + ) + + It " parameter is of type" -TestCases $ParameterTestCases { + param($ParameterName, $Type, $Mandatory, $Validation) + Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type + } + + It " parameter has correct validation setting" -TestCases $ParameterTestCases { + param($ParameterName, $Validation) + Switch ($Validation) { + 'NotNullOrEmpty' { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1 + } + + 'Range' { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.Where{ $_ -is [ValidateRange] }.Count | Should -Be 1 + } + + default { + $true | Should -Be $false -Because "No Validation Selected. Review test cases" + } + } + } + + It "Interval Parameter should have a Min value of 60" { + (Get-Command $global:function).Parameters['Interval'].Attributes.Where{ $_ -is [ValidateRange] }.MinRange | Should -Be 60 + } + + It "Interval Parameter should have a Max value of 2678400" { + (Get-Command $global:function).Parameters['Interval'].Attributes.Where{ $_ -is [ValidateRange] }.MaxRange | Should -Be 2678400 + } + } + + Context "$global:function::Parameter Functional Tests" { + + } +} + +Remove-Variable -Name here -Scope Global +Remove-Variable -Name function -Scope Global diff --git a/Tests/Public/Get-ZANetworkVpgStat.Tests.ps1 b/Tests/Public/Get-ZANetworkVpgStat.Tests.ps1 new file mode 100644 index 0000000..e2ece1b --- /dev/null +++ b/Tests/Public/Get-ZANetworkVpgStat.Tests.ps1 @@ -0,0 +1,49 @@ +#Requires -Modules Pester +$global:here = (Split-Path -Parent $PSCommandPath) +$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0] + +Describe $global:function -Tag 'Unit', 'Source', 'Built' { + + Context "$global:function::Parameter Unit Tests" { + It "$global:function should have exactly 14 parameters defined" { + (Get-Command $global:function).Parameters.Count | Should -Be 14 + } + + $ParameterTestCases = @( + @{ParameterName = 'vpgIdentifier'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'startDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'endDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } + ) + + It " parameter is of type" -TestCases $ParameterTestCases { + param($ParameterName, $Type, $Mandatory, $Validation) + Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type + } + + It " parameter has correct validation setting" -TestCases $ParameterTestCases { + param($ParameterName, $Validation) + Switch ($Validation) { + 'NotNullOrEmpty' { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1 + } + + 'Range' { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.Where{ $_ -is [ValidateRange] }.Count | Should -Be 1 + } + + default { + $true | Should -Be $false -Because "No Validation Selected. Review test cases" + } + } + } + } + + Context "$global:function::Parameter Functional Tests" { + + } +} + +Remove-Variable -Name here -Scope Global +Remove-Variable -Name function -Scope Global diff --git a/Tests/Public/Get-ZANetworkVpgSummary.Tests.ps1 b/Tests/Public/Get-ZANetworkVpgSummary.Tests.ps1 new file mode 100644 index 0000000..e2ece1b --- /dev/null +++ b/Tests/Public/Get-ZANetworkVpgSummary.Tests.ps1 @@ -0,0 +1,49 @@ +#Requires -Modules Pester +$global:here = (Split-Path -Parent $PSCommandPath) +$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0] + +Describe $global:function -Tag 'Unit', 'Source', 'Built' { + + Context "$global:function::Parameter Unit Tests" { + It "$global:function should have exactly 14 parameters defined" { + (Get-Command $global:function).Parameters.Count | Should -Be 14 + } + + $ParameterTestCases = @( + @{ParameterName = 'vpgIdentifier'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'startDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'endDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } + ) + + It " parameter is of type" -TestCases $ParameterTestCases { + param($ParameterName, $Type, $Mandatory, $Validation) + Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type + } + + It " parameter has correct validation setting" -TestCases $ParameterTestCases { + param($ParameterName, $Validation) + Switch ($Validation) { + 'NotNullOrEmpty' { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1 + } + + 'Range' { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.Where{ $_ -is [ValidateRange] }.Count | Should -Be 1 + } + + default { + $true | Should -Be $false -Because "No Validation Selected. Review test cases" + } + } + } + } + + Context "$global:function::Parameter Functional Tests" { + + } +} + +Remove-Variable -Name here -Scope Global +Remove-Variable -Name function -Scope Global diff --git a/Tests/Public/Get-ZAPlannerJournalSizeReport.Tests.ps1 b/Tests/Public/Get-ZAPlannerJournalSizeReport.Tests.ps1 new file mode 100644 index 0000000..f6b7536 --- /dev/null +++ b/Tests/Public/Get-ZAPlannerJournalSizeReport.Tests.ps1 @@ -0,0 +1,57 @@ +#Requires -Modules Pester +$global:here = (Split-Path -Parent $PSCommandPath) +$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0] + +Describe $global:function -Tag 'Unit', 'Source', 'Built' { + + Context "$global:function::Parameter Unit Tests" { + It "$global:function should have exactly 17 parameters defined" { + (Get-Command $global:function).Parameters.Count | Should -Be 17 + } + + $ParameterTestCases = @( + @{ParameterName = 'siteIdentifier'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'vmIdentifier'; Type = 'String[]'; Mandatory = $true; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'recoveryType'; Type = 'String'; Mandatory = $true; Validation = 'Set' } + @{ParameterName = 'desiredJournalHistory'; Type = 'Int'; Mandatory = $false; Validation = 'Range' } + @{ParameterName = 'startDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'endDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } + ) + + It " parameter is of type" -TestCases $ParameterTestCases { + param($ParameterName, $Type, $Mandatory, $Validation) + Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type + } + + It " parameter has correct validation setting" -TestCases $ParameterTestCases { + param($ParameterName, $Validation) + Switch ($Validation) { + 'NotNullOrEmpty' { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1 + } + + 'Range' { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.Where{ $_ -is [ValidateRange] }.Count | Should -Be 1 + } + + 'Set' { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.Where{ $_ -is [ValidateSet] }.Count | Should -Be 1 + } + + default { + $true | Should -Be $false -Because "No Validation Selected. Review test cases" + } + } + } + } + + Context "$global:function::Parameter Functional Tests" { + + } +} + +Remove-Variable -Name here -Scope Global +Remove-Variable -Name function -Scope Global diff --git a/Tests/Public/Get-ZAPlannerNetworkPerformanceReport.Tests.ps1 b/Tests/Public/Get-ZAPlannerNetworkPerformanceReport.Tests.ps1 new file mode 100644 index 0000000..357d797 --- /dev/null +++ b/Tests/Public/Get-ZAPlannerNetworkPerformanceReport.Tests.ps1 @@ -0,0 +1,57 @@ +#Requires -Modules Pester +$global:here = (Split-Path -Parent $PSCommandPath) +$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0] + +Describe $global:function -Tag 'Unit', 'Source', 'Built' { + + Context "$global:function::Parameter Unit Tests" { + It "$global:function should have exactly 17 parameters defined" { + (Get-Command $global:function).Parameters.Count | Should -Be 17 + } + + $ParameterTestCases = @( + @{ParameterName = 'siteIdentifier'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'vmIdentifier'; Type = 'String[]'; Mandatory = $true; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'recoveryType'; Type = 'String'; Mandatory = $true; Validation = 'Set' } + @{ParameterName = 'interval'; Type = 'Int'; Mandatory = $false; Validation = 'Range' } + @{ParameterName = 'startDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'endDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } + ) + + It " parameter is of type" -TestCases $ParameterTestCases { + param($ParameterName, $Type, $Mandatory, $Validation) + Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type + } + + It " parameter has correct validation setting" -TestCases $ParameterTestCases { + param($ParameterName, $Validation) + Switch ($Validation) { + 'NotNullOrEmpty' { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1 + } + + 'Range' { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.Where{ $_ -is [ValidateRange] }.Count | Should -Be 1 + } + + 'Set' { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.Where{ $_ -is [ValidateSet] }.Count | Should -Be 1 + } + + default { + $true | Should -Be $false -Because "No Validation Selected. Review test cases" + } + } + } + } + + Context "$global:function::Parameter Functional Tests" { + + } +} + +Remove-Variable -Name here -Scope Global +Remove-Variable -Name function -Scope Global diff --git a/Tests/Public/Get-ZAPlannerSite.Tests.ps1 b/Tests/Public/Get-ZAPlannerSite.Tests.ps1 new file mode 100644 index 0000000..0697f3d --- /dev/null +++ b/Tests/Public/Get-ZAPlannerSite.Tests.ps1 @@ -0,0 +1,42 @@ +#Requires -Modules Pester +$global:here = (Split-Path -Parent $PSCommandPath) +$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0] + +Describe $global:function -Tag 'Unit', 'Source', 'Built' { + + Context "$global:function::Parameter Unit Tests" { + It "$global:function should have exactly 12 parameters defined" { + (Get-Command $global:function).Parameters.Count | Should -Be 12 + } + + $ParameterTestCases = @( + @{ParameterName = 'siteIdentifier'; Type = 'String[]'; Mandatory = $false; Validation = 'NotNullOrEmpty' } + ) + + It " parameter is of type" -TestCases $ParameterTestCases { + param($ParameterName, $Type, $Mandatory, $Validation) + Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type + } + + It " parameter has correct validation setting" -TestCases $ParameterTestCases { + param($ParameterName, $Validation) + Switch ($Validation) { + 'NotNullOrEmpty' { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1 + } + + default { + $true | Should -Be $false -Because "No Validation Selected. Review test cases" + } + } + } + } + + Context "$global:function::Parameter Functional Tests" { + + } +} + +Remove-Variable -Name here -Scope Global +Remove-Variable -Name function -Scope Global diff --git a/Tests/Public/Get-ZAPlannerStatsReport.Tests.ps1 b/Tests/Public/Get-ZAPlannerStatsReport.Tests.ps1 new file mode 100644 index 0000000..f6b7536 --- /dev/null +++ b/Tests/Public/Get-ZAPlannerStatsReport.Tests.ps1 @@ -0,0 +1,57 @@ +#Requires -Modules Pester +$global:here = (Split-Path -Parent $PSCommandPath) +$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0] + +Describe $global:function -Tag 'Unit', 'Source', 'Built' { + + Context "$global:function::Parameter Unit Tests" { + It "$global:function should have exactly 17 parameters defined" { + (Get-Command $global:function).Parameters.Count | Should -Be 17 + } + + $ParameterTestCases = @( + @{ParameterName = 'siteIdentifier'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'vmIdentifier'; Type = 'String[]'; Mandatory = $true; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'recoveryType'; Type = 'String'; Mandatory = $true; Validation = 'Set' } + @{ParameterName = 'desiredJournalHistory'; Type = 'Int'; Mandatory = $false; Validation = 'Range' } + @{ParameterName = 'startDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'endDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } + ) + + It " parameter is of type" -TestCases $ParameterTestCases { + param($ParameterName, $Type, $Mandatory, $Validation) + Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type + } + + It " parameter has correct validation setting" -TestCases $ParameterTestCases { + param($ParameterName, $Validation) + Switch ($Validation) { + 'NotNullOrEmpty' { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1 + } + + 'Range' { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.Where{ $_ -is [ValidateRange] }.Count | Should -Be 1 + } + + 'Set' { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.Where{ $_ -is [ValidateSet] }.Count | Should -Be 1 + } + + default { + $true | Should -Be $false -Because "No Validation Selected. Review test cases" + } + } + } + } + + Context "$global:function::Parameter Functional Tests" { + + } +} + +Remove-Variable -Name here -Scope Global +Remove-Variable -Name function -Scope Global diff --git a/Tests/Public/Get-ZAPlannerWanReport.Tests.ps1 b/Tests/Public/Get-ZAPlannerWanReport.Tests.ps1 new file mode 100644 index 0000000..6f43e52 --- /dev/null +++ b/Tests/Public/Get-ZAPlannerWanReport.Tests.ps1 @@ -0,0 +1,56 @@ +#Requires -Modules Pester +$global:here = (Split-Path -Parent $PSCommandPath) +$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0] + +Describe $global:function -Tag 'Unit', 'Source', 'Built' { + + Context "$global:function::Parameter Unit Tests" { + It "$global:function should have exactly 14 parameters defined" { + (Get-Command $global:function).Parameters.Count | Should -Be 16 + } + + $ParameterTestCases = @( + @{ParameterName = 'siteIdentifier'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'vmIdentifier'; Type = 'String[]'; Mandatory = $true; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'recoveryType'; Type = 'String'; Mandatory = $true; Validation = 'Set' } + @{ParameterName = 'startDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'endDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } + ) + + It " parameter is of type" -TestCases $ParameterTestCases { + param($ParameterName, $Type, $Mandatory, $Validation) + Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type + } + + It " parameter has correct validation setting" -TestCases $ParameterTestCases { + param($ParameterName, $Validation) + Switch ($Validation) { + 'NotNullOrEmpty' { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1 + } + + 'Range' { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.Where{ $_ -is [ValidateRange] }.Count | Should -Be 1 + } + + 'Set' { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.Where{ $_ -is [ValidateSet] }.Count | Should -Be 1 + } + + default { + $true | Should -Be $false -Because "No Validation Selected. Review test cases" + } + } + } + } + + Context "$global:function::Parameter Functional Tests" { + + } +} + +Remove-Variable -Name here -Scope Global +Remove-Variable -Name function -Scope Global diff --git a/Tests/Public/Get-ZAPlannerZcasReport.Tests.ps1 b/Tests/Public/Get-ZAPlannerZcasReport.Tests.ps1 new file mode 100644 index 0000000..9940422 --- /dev/null +++ b/Tests/Public/Get-ZAPlannerZcasReport.Tests.ps1 @@ -0,0 +1,56 @@ +#Requires -Modules Pester +$global:here = (Split-Path -Parent $PSCommandPath) +$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0] + +Describe $global:function -Tag 'Unit', 'Source', 'Built' { + + Context "$global:function::Parameter Unit Tests" { + It "$global:function should have exactly 16 parameters defined" { + (Get-Command $global:function).Parameters.Count | Should -Be 16 + } + + $ParameterTestCases = @( + @{ParameterName = 'siteIdentifier'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'vmIdentifier'; Type = 'String[]'; Mandatory = $true; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'recoveryType'; Type = 'String'; Mandatory = $true; Validation = 'Set' } + @{ParameterName = 'startDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'endDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } + ) + + It " parameter is of type" -TestCases $ParameterTestCases { + param($ParameterName, $Type, $Mandatory, $Validation) + Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type + } + + It " parameter has correct validation setting" -TestCases $ParameterTestCases { + param($ParameterName, $Validation) + Switch ($Validation) { + 'NotNullOrEmpty' { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1 + } + + 'Range' { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.Where{ $_ -is [ValidateRange] }.Count | Should -Be 1 + } + + 'Set' { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.Where{ $_ -is [ValidateSet] }.Count | Should -Be 1 + } + + default { + $true | Should -Be $false -Because "No Validation Selected. Review test cases" + } + } + } + } + + Context "$global:function::Parameter Functional Tests" { + + } +} + +Remove-Variable -Name here -Scope Global +Remove-Variable -Name function -Scope Global diff --git a/Tests/Public/Get-ZAProtectedVm.Tests.ps1 b/Tests/Public/Get-ZAProtectedVm.Tests.ps1 new file mode 100644 index 0000000..cb28168 --- /dev/null +++ b/Tests/Public/Get-ZAProtectedVm.Tests.ps1 @@ -0,0 +1,41 @@ +#Requires -Modules Pester +$global:here = (Split-Path -Parent $PSCommandPath) +$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0] + +Describe $global:function -Tag 'Unit', 'Source', 'Built' { + + Context "$global:function::Parameter Unit Tests" { + It "$global:function should have exactly 14 parameters defined" { + (Get-Command $global:function).Parameters.Count | Should -Be 14 + } + + $ParameterTestCases = @( + @{ParameterName = 'AllVms'; Type = 'Switch'; Mandatory = $false; Validation = $Null } + @{ParameterName = 'vmIdentifier'; Type = 'String[]'; Mandatory = $true; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'Volumes'; Type = 'Switch'; Mandatory = $false; Validation = $Null } + ) + + It " parameter is of type" -TestCases $ParameterTestCases { + param($ParameterName, $Type, $Mandatory, $Validation) + Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type + } + + It " parameter has correct validation setting" -TestCases $ParameterTestCases { + param($ParameterName, $Validation) + Switch ($Validation) { + 'NotNullOrEmpty' { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1 + } + + } + } + } + + Context "$global:function::Parameter Functional Tests" { + + } +} + +Remove-Variable -Name here -Scope Global +Remove-Variable -Name function -Scope Global diff --git a/Tests/Public/Get-ZAProtectedVmReport.Tests.ps1 b/Tests/Public/Get-ZAProtectedVmReport.Tests.ps1 new file mode 100644 index 0000000..40af444 --- /dev/null +++ b/Tests/Public/Get-ZAProtectedVmReport.Tests.ps1 @@ -0,0 +1,39 @@ +#Requires -Modules Pester +$global:here = (Split-Path -Parent $PSCommandPath) +$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0] + +Describe $global:function -Tag 'Unit', 'Source', 'Built' { + + Context "$global:function::Parameter Unit Tests" { + It "$global:function should have exactly 12 parameters defined" { + (Get-Command $global:function).Parameters.Count | Should -Be 12 + } + + $ParameterTestCases = @( + @{ParameterName = 'vmIdentifier'; Type = 'String[]'; Mandatory = $true; Validation = 'NotNullOrEmpty' } + ) + + It " parameter is of type" -TestCases $ParameterTestCases { + param($ParameterName, $Type, $Mandatory, $Validation) + Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type + } + + It " parameter has correct validation setting" -TestCases $ParameterTestCases { + param($ParameterName, $Validation) + Switch ($Validation) { + 'NotNullOrEmpty' { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1 + } + + } + } + } + + Context "$global:function::Parameter Functional Tests" { + + } +} + +Remove-Variable -Name here -Scope Global +Remove-Variable -Name function -Scope Global diff --git a/Tests/Public/Get-ZARPOAccountAverage.Tests.ps1 b/Tests/Public/Get-ZARPOAccountAverage.Tests.ps1 new file mode 100644 index 0000000..5ba5c2d --- /dev/null +++ b/Tests/Public/Get-ZARPOAccountAverage.Tests.ps1 @@ -0,0 +1,44 @@ +#Requires -Modules Pester +$global:here = (Split-Path -Parent $PSCommandPath) +$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0] + +Describe $global:function -Tag 'Unit', 'Source', 'Built' { + + Context "$global:function::Parameter Unit Tests" { + It "$global:function should have exactly 14 parameters defined" { + (Get-Command $global:function).Parameters.Count | Should -Be 14 + } + + $ParameterTestCases = @( + @{ParameterName = 'zOrgIdentifier'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'startDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'endDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } + ) + + It " parameter is of type" -TestCases $ParameterTestCases { + param($ParameterName, $Type, $Mandatory, $Validation) + Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type + } + + It " parameter has correct validation setting" -TestCases $ParameterTestCases { + param($ParameterName, $Validation) + Switch ($Validation) { + 'NotNullOrEmpty' { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1 + } + + default { + $true | Should -Be $false -Because "No Validation Selected. Review test cases" + } + } + } + } + + Context "$global:function::Parameter Functional Tests" { + + } +} + +Remove-Variable -Name here -Scope Global +Remove-Variable -Name function -Scope Global diff --git a/Tests/Public/Get-ZARPOAverage.Tests.ps1 b/Tests/Public/Get-ZARPOAverage.Tests.ps1 new file mode 100644 index 0000000..eb3a548 --- /dev/null +++ b/Tests/Public/Get-ZARPOAverage.Tests.ps1 @@ -0,0 +1,58 @@ +#Requires -Modules Pester +$global:here = (Split-Path -Parent $PSCommandPath) +$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0] + +Describe $global:function -Tag 'Unit', 'Source', 'Built' { + + Context "$global:function::Parameter Unit Tests" { + It "$global:function should have exactly 15 parameters defined" { + (Get-Command $global:function).Parameters.Count | Should -Be 15 + } + + $ParameterTestCases = @( + @{ParameterName = 'vpgIdentifier'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'startDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'endDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'Interval'; Type = 'Int32'; Mandatory = $false; Validation = 'Range' } + ) + + It " parameter is of type" -TestCases $ParameterTestCases { + param($ParameterName, $Type, $Mandatory, $Validation) + Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type + } + + It " parameter has correct validation setting" -TestCases $ParameterTestCases { + param($ParameterName, $Validation) + Switch ($Validation) { + 'NotNullOrEmpty' { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1 + } + + 'Range' { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.Where{ $_ -is [ValidateRange] }.Count | Should -Be 1 + } + + default { + $true | Should -Be $false -Because "No Validation Selected. Review test cases" + } + } + } + + It "Interval Parameter should have a Min value of 60" { + (Get-Command $global:function).Parameters['Interval'].Attributes.Where{ $_ -is [ValidateRange] }.MinRange | Should -Be 60 + } + + It "Interval Parameter should have a Max value of 2678400" { + (Get-Command $global:function).Parameters['Interval'].Attributes.Where{ $_ -is [ValidateRange] }.MaxRange | Should -Be 2678400 + } + } + + Context "$global:function::Parameter Functional Tests" { + + } +} + +Remove-Variable -Name here -Scope Global +Remove-Variable -Name function -Scope Global diff --git a/Tests/Public/Get-ZARPOBreach.Tests.ps1 b/Tests/Public/Get-ZARPOBreach.Tests.ps1 new file mode 100644 index 0000000..94b7a9e --- /dev/null +++ b/Tests/Public/Get-ZARPOBreach.Tests.ps1 @@ -0,0 +1,44 @@ +#Requires -Modules Pester +$global:here = (Split-Path -Parent $PSCommandPath) +$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0] + +Describe $global:function -Tag 'Unit', 'Source', 'Built' { + + Context "$global:function::Parameter Unit Tests" { + It "$global:function should have exactly 14 parameters defined" { + (Get-Command $global:function).Parameters.Count | Should -Be 14 + } + + $ParameterTestCases = @( + @{ParameterName = 'vpgIdentifier'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'startDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'endDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } + ) + + It " parameter is of type" -TestCases $ParameterTestCases { + param($ParameterName, $Type, $Mandatory, $Validation) + Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type + } + + It " parameter has correct validation setting" -TestCases $ParameterTestCases { + param($ParameterName, $Validation) + Switch ($Validation) { + 'NotNullOrEmpty' { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1 + } + + default { + $true | Should -Be $false -Because "No Validation Selected. Review test cases" + } + } + } + } + + Context "$global:function::Parameter Functional Tests" { + + } +} + +Remove-Variable -Name here -Scope Global +Remove-Variable -Name function -Scope Global diff --git a/Tests/Public/Get-ZARPOStat.Tests.ps1 b/Tests/Public/Get-ZARPOStat.Tests.ps1 new file mode 100644 index 0000000..94b7a9e --- /dev/null +++ b/Tests/Public/Get-ZARPOStat.Tests.ps1 @@ -0,0 +1,44 @@ +#Requires -Modules Pester +$global:here = (Split-Path -Parent $PSCommandPath) +$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0] + +Describe $global:function -Tag 'Unit', 'Source', 'Built' { + + Context "$global:function::Parameter Unit Tests" { + It "$global:function should have exactly 14 parameters defined" { + (Get-Command $global:function).Parameters.Count | Should -Be 14 + } + + $ParameterTestCases = @( + @{ParameterName = 'vpgIdentifier'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'startDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'endDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } + ) + + It " parameter is of type" -TestCases $ParameterTestCases { + param($ParameterName, $Type, $Mandatory, $Validation) + Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type + } + + It " parameter has correct validation setting" -TestCases $ParameterTestCases { + param($ParameterName, $Validation) + Switch ($Validation) { + 'NotNullOrEmpty' { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1 + } + + default { + $true | Should -Be $false -Because "No Validation Selected. Review test cases" + } + } + } + } + + Context "$global:function::Parameter Functional Tests" { + + } +} + +Remove-Variable -Name here -Scope Global +Remove-Variable -Name function -Scope Global diff --git a/Tests/Public/Get-ZARPOStatusProportion.Tests.ps1 b/Tests/Public/Get-ZARPOStatusProportion.Tests.ps1 new file mode 100644 index 0000000..94b7a9e --- /dev/null +++ b/Tests/Public/Get-ZARPOStatusProportion.Tests.ps1 @@ -0,0 +1,44 @@ +#Requires -Modules Pester +$global:here = (Split-Path -Parent $PSCommandPath) +$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0] + +Describe $global:function -Tag 'Unit', 'Source', 'Built' { + + Context "$global:function::Parameter Unit Tests" { + It "$global:function should have exactly 14 parameters defined" { + (Get-Command $global:function).Parameters.Count | Should -Be 14 + } + + $ParameterTestCases = @( + @{ParameterName = 'vpgIdentifier'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'startDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'endDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } + ) + + It " parameter is of type" -TestCases $ParameterTestCases { + param($ParameterName, $Type, $Mandatory, $Validation) + Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type + } + + It " parameter has correct validation setting" -TestCases $ParameterTestCases { + param($ParameterName, $Validation) + Switch ($Validation) { + 'NotNullOrEmpty' { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1 + } + + default { + $true | Should -Be $false -Because "No Validation Selected. Review test cases" + } + } + } + } + + Context "$global:function::Parameter Functional Tests" { + + } +} + +Remove-Variable -Name here -Scope Global +Remove-Variable -Name function -Scope Global diff --git a/Tests/Public/Get-ZARPOSummary.Tests.ps1 b/Tests/Public/Get-ZARPOSummary.Tests.ps1 new file mode 100644 index 0000000..94b7a9e --- /dev/null +++ b/Tests/Public/Get-ZARPOSummary.Tests.ps1 @@ -0,0 +1,44 @@ +#Requires -Modules Pester +$global:here = (Split-Path -Parent $PSCommandPath) +$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0] + +Describe $global:function -Tag 'Unit', 'Source', 'Built' { + + Context "$global:function::Parameter Unit Tests" { + It "$global:function should have exactly 14 parameters defined" { + (Get-Command $global:function).Parameters.Count | Should -Be 14 + } + + $ParameterTestCases = @( + @{ParameterName = 'vpgIdentifier'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'startDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'endDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } + ) + + It " parameter is of type" -TestCases $ParameterTestCases { + param($ParameterName, $Type, $Mandatory, $Validation) + Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type + } + + It " parameter has correct validation setting" -TestCases $ParameterTestCases { + param($ParameterName, $Validation) + Switch ($Validation) { + 'NotNullOrEmpty' { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1 + } + + default { + $true | Should -Be $false -Because "No Validation Selected. Review test cases" + } + } + } + } + + Context "$global:function::Parameter Functional Tests" { + + } +} + +Remove-Variable -Name here -Scope Global +Remove-Variable -Name function -Scope Global diff --git a/Tests/Public/Get-ZASite.Tests.ps1 b/Tests/Public/Get-ZASite.Tests.ps1 new file mode 100644 index 0000000..6ce1ca9 --- /dev/null +++ b/Tests/Public/Get-ZASite.Tests.ps1 @@ -0,0 +1,28 @@ +#Requires -Modules Pester +$global:here = (Split-Path -Parent $PSCommandPath) +$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0] + +Describe $global:function -Tag 'Unit', 'Source', 'Built' { + + Context "$global:function::Parameter Unit Tests" { + It "$global:function should have exactly 12 parameters defined" { + (Get-Command $global:function).Parameters.Count | Should -Be 12 + } + + It "zOrgIdentifier Parameter should be present and of 'String' Type" { + Get-Command $global:function | Should -HaveParameter zOrgIdentifier -Type String -Mandatory:$false + } + + It "zOrgIdentifier has the NotNullOrEmpty Validator" { + (Get-Command $global:function).Parameters['zOrgIdentifier'].Attributes.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1 + } + + } + + Context "$global:function::Parameter Functional Tests" { + + } +} + +Remove-Variable -Name here -Scope Global +Remove-Variable -Name function -Scope Global diff --git a/Tests/Public/Get-ZASitePair.Tests.ps1 b/Tests/Public/Get-ZASitePair.Tests.ps1 new file mode 100644 index 0000000..5ba5c2d --- /dev/null +++ b/Tests/Public/Get-ZASitePair.Tests.ps1 @@ -0,0 +1,44 @@ +#Requires -Modules Pester +$global:here = (Split-Path -Parent $PSCommandPath) +$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0] + +Describe $global:function -Tag 'Unit', 'Source', 'Built' { + + Context "$global:function::Parameter Unit Tests" { + It "$global:function should have exactly 14 parameters defined" { + (Get-Command $global:function).Parameters.Count | Should -Be 14 + } + + $ParameterTestCases = @( + @{ParameterName = 'zOrgIdentifier'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'startDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'endDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } + ) + + It " parameter is of type" -TestCases $ParameterTestCases { + param($ParameterName, $Type, $Mandatory, $Validation) + Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type + } + + It " parameter has correct validation setting" -TestCases $ParameterTestCases { + param($ParameterName, $Validation) + Switch ($Validation) { + 'NotNullOrEmpty' { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1 + } + + default { + $true | Should -Be $false -Because "No Validation Selected. Review test cases" + } + } + } + } + + Context "$global:function::Parameter Functional Tests" { + + } +} + +Remove-Variable -Name here -Scope Global +Remove-Variable -Name function -Scope Global diff --git a/Tests/Public/Get-ZASiteTopology.Tests.ps1 b/Tests/Public/Get-ZASiteTopology.Tests.ps1 new file mode 100644 index 0000000..ebe6cb0 --- /dev/null +++ b/Tests/Public/Get-ZASiteTopology.Tests.ps1 @@ -0,0 +1,42 @@ +#Requires -Modules Pester +$global:here = (Split-Path -Parent $PSCommandPath) +$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0] + +Describe $global:function -Tag 'Unit', 'Source', 'Built' { + + Context "$global:function::Parameter Unit Tests" { + It "$global:function should have exactly 12 parameters defined" { + (Get-Command $global:function).Parameters.Count | Should -Be 12 + } + + $ParameterTestCases = @( + @{ParameterName = 'zOrgIdentifier'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } + ) + + It " parameter is of type" -TestCases $ParameterTestCases { + param($ParameterName, $Type, $Mandatory, $Validation) + Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type + } + + It " parameter has correct validation setting" -TestCases $ParameterTestCases { + param($ParameterName, $Validation) + Switch ($Validation) { + 'NotNullOrEmpty' { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1 + } + + default { + $true | Should -Be $false -Because "No Validation Selected. Review test cases" + } + } + } + } + + Context "$global:function::Parameter Functional Tests" { + + } +} + +Remove-Variable -Name here -Scope Global +Remove-Variable -Name function -Scope Global diff --git a/Tests/Public/Get-ZATask.Tests.ps1 b/Tests/Public/Get-ZATask.Tests.ps1 new file mode 100644 index 0000000..2a38bde --- /dev/null +++ b/Tests/Public/Get-ZATask.Tests.ps1 @@ -0,0 +1,57 @@ +#Requires -Modules Pester +$global:here = (Split-Path -Parent $PSCommandPath) +$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0] + +Describe $global:function -Tag 'Unit', 'Source', 'Built' { + + Context "$global:function::Parameter Unit Tests" { + It "$global:function should have exactly 14 parameters defined" { + (Get-Command $global:function).Parameters.Count | Should -Be 14 + } + + $ParameterTestCases = @( + @{ParameterName = 'zOrgIdentifier'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'limitTo'; Type = 'Int'; Mandatory = $false; Validation = 'Range' } + @{ParameterName = 'taskIdentifier'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' } + ) + + It " parameter is of type" -TestCases $ParameterTestCases { + param($ParameterName, $Type, $Mandatory, $Validation) + Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type + } + + It " parameter has correct validation setting" -TestCases $ParameterTestCases { + param($ParameterName, $Validation) + Switch ($Validation) { + 'NotNullOrEmpty' { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1 + } + + 'Range' { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.Where{ $_ -is [ValidateRange] }.Count | Should -Be 1 + } + + default { + $true | Should -Be $false -Because "No Validation Selected. Review test cases" + } + } + } + + It "Interval Parameter should have a Min value of 1" { + (Get-Command $global:function).Parameters['limitTo'].Attributes.Where{ $_ -is [ValidateRange] }.MinRange | Should -Be 1 + } + + It "Interval Parameter should have a Max value of 1000000" { + (Get-Command $global:function).Parameters['limitTo'].Attributes.Where{ $_ -is [ValidateRange] }.MaxRange | Should -Be 1000000 + } + } + + Context "$global:function::Parameter Functional Tests" { + + } +} + +Remove-Variable -Name here -Scope Global +Remove-Variable -Name function -Scope Global diff --git a/Tests/Public/Get-ZAVolume.Tests.ps1 b/Tests/Public/Get-ZAVolume.Tests.ps1 new file mode 100644 index 0000000..7042d03 --- /dev/null +++ b/Tests/Public/Get-ZAVolume.Tests.ps1 @@ -0,0 +1,45 @@ +#Requires -Modules Pester +$global:here = (Split-Path -Parent $PSCommandPath) +$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0] + +Describe $global:function -Tag 'Unit', 'Source', 'Built' { + + Context "$global:function::Parameter Unit Tests" { + It "$global:function should have exactly 15 parameters defined" { + (Get-Command $global:function).Parameters.Count | Should -Be 15 + } + + $ParameterTestCases = @( + @{ParameterName = 'siteIdentifier'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'clusterIdentifier'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'datastoreIdentifier'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'vpgIdentifier'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' } + ) + + It " parameter is of type" -TestCases $ParameterTestCases { + param($ParameterName, $Type, $Mandatory, $Validation) + Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type + } + + It " parameter has correct validation setting" -TestCases $ParameterTestCases { + param($ParameterName, $Validation) + Switch ($Validation) { + 'NotNullOrEmpty' { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1 + } + + default { + $true | Should -Be $false -Because "No Validation Selected. Review test cases" + } + } + } + + Context "$global:function::Parameter Functional Tests" { + + } + } +} + +Remove-Variable -Name here -Scope Global +Remove-Variable -Name function -Scope Global diff --git a/Tests/Public/Get-ZAVpg.Tests.ps1 b/Tests/Public/Get-ZAVpg.Tests.ps1 new file mode 100644 index 0000000..90f9b3f --- /dev/null +++ b/Tests/Public/Get-ZAVpg.Tests.ps1 @@ -0,0 +1,43 @@ +#Requires -Modules Pester +$global:here = (Split-Path -Parent $PSCommandPath) +$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0] + +Describe $global:function -Tag 'Unit', 'Source', 'Built' { + + Context "$global:function::Parameter Unit Tests" { + It "$global:function should have exactly 13 parameters defined" { + (Get-Command $global:function).Parameters.Count | Should -Be 13 + } + + $ParameterTestCases = @( + @{ParameterName = 'zOrgIdentifier'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'vpgIdentifier'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' } + ) + + It " parameter is of type" -TestCases $ParameterTestCases { + param($ParameterName, $Type, $Mandatory, $Validation) + Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type + } + + It " parameter has correct validation setting" -TestCases $ParameterTestCases { + param($ParameterName, $Validation) + Switch ($Validation) { + 'NotNullOrEmpty' { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1 + } + + default { + $true | Should -Be $false -Because "No Validation Selected. Review test cases" + } + } + } + + Context "$global:function::Parameter Functional Tests" { + + } + } +} + +Remove-Variable -Name here -Scope Global +Remove-Variable -Name function -Scope Global diff --git a/Tests/Public/Get-ZAzOrg.Tests.ps1 b/Tests/Public/Get-ZAzOrg.Tests.ps1 new file mode 100644 index 0000000..e3e16ee --- /dev/null +++ b/Tests/Public/Get-ZAzOrg.Tests.ps1 @@ -0,0 +1,19 @@ +#Requires -Modules Pester +$global:here = (Split-Path -Parent $PSCommandPath) +$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0] + +Describe $global:function -Tag 'Unit', 'Source', 'Built' { + + Context "$global:function::Parameter Unit Tests" { + It "$global:function should have exactly 11 parameters defined" { + (Get-Command $global:function).Parameters.Count | Should -Be 11 + } + } + + Context "$global:function::Parameter Functional Tests" { + + } +} + +Remove-Variable -Name here -Scope Global +Remove-Variable -Name function -Scope Global diff --git a/Tests/Public/Get-ZertoAlert.Tests.ps1 b/Tests/Public/Get-ZertoAlert.Tests.ps1 index 1367839..9944cda 100644 --- a/Tests/Public/Get-ZertoAlert.Tests.ps1 +++ b/Tests/Public/Get-ZertoAlert.Tests.ps1 @@ -1,29 +1,51 @@ #Requires -Modules Pester -$moduleFileName = "ZertoApiWrapper.psd1" -$here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper") -$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".") -$file = Get-ChildItem "$here\$sut" -$modulePath = $here -replace "Public", "" -$moduleFile = Get-ChildItem "$modulePath\$moduleFileName" -Get-Module -Name ZertoApiWrapper | Remove-Module -Force -Import-Module $moduleFile -Force - -Describe $file.BaseName -Tag 'Unit' { - - It "is valid Powershell (Has no script errors)" { - $contents = Get-Content -Path $file -ErrorAction Stop - $errors = $null - $null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors) - $errors | Should -HaveCount 0 - } +$global:here = (Split-Path -Parent $PSCommandPath) +$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0] + +Describe $global:function -Tag 'Unit', 'Source', 'Built' { - Context "$($file.BaseName)::Parameter Unit Tests" { + Context "$global:function::Parameter Unit Tests" { - it "Has a mandatory string parameter for the Alert identifier" { - Get-Command $file.BaseName | Should -HaveParameter alertId -Mandatory -Type String[] + $ParameterTestCases = @( + @{ParameterName = 'alertId'; Type = 'String[]'; Mandatory = $true; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'entities'; Type = 'Switch'; Mandatory = $false; Validation = $null } + @{ParameterName = 'helpIdentifiers'; Type = 'Switch'; Mandatory = $false; Validation = $null } + @{ParameterName = 'levels'; Type = 'Switch'; Mandatory = $false; Validation = $null } + @{ParameterName = 'startDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'endDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'vpgIdentifier'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'siteIdentifier'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'zOrgIdentifier'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'level'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'helpIdentifier'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'isDismissed'; Type = 'bool'; Mandatory = $false; Validation = $null } + ) + + It " parameter is of type" -TestCases $ParameterTestCases { + param($ParameterName, $Type, $Mandatory, $Validation) + Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type } + It " parameter has correct validation setting" -TestCases $ParameterTestCases { + param($ParameterName, $Validation) + Switch ($Validation) { + 'NotNullOrEmpty' { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1 + } + + $null { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.TypeId.Count | Should -Be 2 + } + } + } } + Context "$global:function::Parameter Functional Tests" { + + } } +Remove-Variable -Name here -Scope Global +Remove-Variable -Name function -Scope Global diff --git a/Tests/Public/Get-ZertoDatastore.Tests.ps1 b/Tests/Public/Get-ZertoDatastore.Tests.ps1 index 50d2f9d..a250084 100644 --- a/Tests/Public/Get-ZertoDatastore.Tests.ps1 +++ b/Tests/Public/Get-ZertoDatastore.Tests.ps1 @@ -1,19 +1,25 @@ #Requires -Modules Pester -$moduleFileName = "ZertoApiWrapper.psd1" -$here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper") -$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".") -$file = Get-ChildItem "$here\$sut" -$modulePath = $here -replace "Public", "" -$moduleFile = Get-ChildItem "$modulePath\$moduleFileName" -Get-Module -Name ZertoApiWrapper | Remove-Module -Force -Import-Module $moduleFile -Force +$global:here = (Split-Path -Parent $PSCommandPath) +$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0] -Describe $file.BaseName -Tag 'Unit' { +Describe $global:function -Tag 'Unit', 'Source', 'Built' { + + Context "$global:function::Parameter Unit Tests" { + + It "has a non-mandatory string parameter for the datacenterIdentifier" { + Get-Command $global:function | Should -HaveParameter datastoreIdentifier + Get-Command $global:function | Should -HaveParameter datastoreIdentifier -Type String[] + } + + It "datastoreIdentifier parameter does not take null or empty values" { + (Get-Command $global:function).Parameters['datastoreIdentifier'].Attributes.Where{ $_ -is [ValidateNotNullOrEmpty] }.count | Should -Be 1 + } + } + + Context "$global:function::Parameter Functional Tests" { - It "is valid Powershell (Has no script errors)" { - $contents = Get-Content -Path $file -ErrorAction Stop - $errors = $null - $null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors) - $errors | Should -HaveCount 0 } -} \ No newline at end of file +} + +Remove-Variable -Name here -Scope Global +Remove-Variable -Name function -Scope Global diff --git a/Tests/Public/Get-ZertoEvent.Tests.ps1 b/Tests/Public/Get-ZertoEvent.Tests.ps1 index 50d2f9d..5e94a0e 100644 --- a/Tests/Public/Get-ZertoEvent.Tests.ps1 +++ b/Tests/Public/Get-ZertoEvent.Tests.ps1 @@ -1,19 +1,120 @@ #Requires -Modules Pester -$moduleFileName = "ZertoApiWrapper.psd1" -$here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper") -$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".") -$file = Get-ChildItem "$here\$sut" -$modulePath = $here -replace "Public", "" -$moduleFile = Get-ChildItem "$modulePath\$moduleFileName" -Get-Module -Name ZertoApiWrapper | Remove-Module -Force -Import-Module $moduleFile -Force - -Describe $file.BaseName -Tag 'Unit' { - - It "is valid Powershell (Has no script errors)" { - $contents = Get-Content -Path $file -ErrorAction Stop - $errors = $null - $null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors) - $errors | Should -HaveCount 0 +$global:here = (Split-Path -Parent $PSCommandPath) +$global:function = ((Split-Path -Leaf $PSCommandPath).Split('.'))[0] + +Describe $global:function -Tag 'Unit', 'Source', 'Built' { + + Context "$global:function::Parameter Unit Tests" { + It "$global:function should have exactly 28 parameters defined" { + (Get-Command $global:function).Parameters.Count | Should -Be 28 + } + + $ParameterTestCases = @( + @{ParameterName = 'startDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'endDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'vpg'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'vpgIdentifier'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'eventType'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'siteName'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'siteIdentifier'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'zOrgIdentifier'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'entityType'; Type = 'String'; Mandatory = $false; Validation = 'Set' } + @{ParameterName = 'userName'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'category'; Type = 'String'; Mandatory = $false; Validation = 'Set' } + @{ParameterName = 'eventCategory'; Type = 'String'; Mandatory = $false; Validation = 'Set' } + @{ParameterName = 'alertIdentifier'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'eventId'; Type = 'String[]'; Mandatory = $true; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'categories'; Type = 'Switch'; Mandatory = $true; Validation = $null } + @{ParameterName = 'entities'; Type = 'Switch'; Mandatory = $true; Validation = $null } + @{ParameterName = 'types'; Type = 'Switch'; Mandatory = $true; Validation = $null } + ) + + It " parameter is of type" -TestCases $ParameterTestCases { + param($ParameterName, $Type, $Mandatory, $Validation) + Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type + } + + It " parameter has correct validation setting" -TestCases $ParameterTestCases { + param($ParameterName, $Validation) + Switch ($Validation) { + 'NotNullOrEmpty' { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1 + } + + 'Set' { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.Where{ $_ -is [ValidateSet] }.Count | Should -Be 1 + } + + $null { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.TypeId.Count | Should -Be 2 + } + + default { + $true | Should -Be $false -Because "No Validation Selected. Review test cases" + } + } + } + + It "entityType parameter only accecpts 4 different values" { + (Get-Command $global:function).Parameters['entityType'].Attributes.Where{ $_ -is [ValidateSet] }.ValidValues.Count | Should -Be 4 + } + + It "entityType parameter accecpts 'VPG' as a Value" { + (Get-Command $global:function).Parameters['entityType'].Attributes.Where{ $_ -is [ValidateSet] }.ValidValues | Should -Contain 'VPG' + } + + It "entityType parameter accecpts 'VRA' as a Value" { + (Get-Command $global:function).Parameters['entityType'].Attributes.Where{ $_ -is [ValidateSet] }.ValidValues | Should -Contain 'VRA' + } + + It "entityType parameter accecpts 'Unknown' as a Value" { + (Get-Command $global:function).Parameters['entityType'].Attributes.Where{ $_ -is [ValidateSet] }.ValidValues | Should -Contain 'Unknown' + } + + It "entityType parameter accecpts 'Site' as a Value" { + (Get-Command $global:function).Parameters['entityType'].Attributes.Where{ $_ -is [ValidateSet] }.ValidValues | Should -Contain 'Site' + } + + It "category parameter only accecpts 3 different values" { + (Get-Command $global:function).Parameters['category'].Attributes.Where{ $_ -is [ValidateSet] }.ValidValues.Count | Should -Be 3 + } + + It "category parameter accecpts 'All' as a Value" { + (Get-Command $global:function).Parameters['category'].Attributes.Where{ $_ -is [ValidateSet] }.ValidValues | Should -Contain 'All' + } + + It "category parameter accecpts 'events' as a Value" { + (Get-Command $global:function).Parameters['category'].Attributes.Where{ $_ -is [ValidateSet] }.ValidValues | Should -Contain 'events' + } + + It "category parameter accecpts 'alerts' as a Value" { + (Get-Command $global:function).Parameters['category'].Attributes.Where{ $_ -is [ValidateSet] }.ValidValues | Should -Contain 'alerts' + } + + It "eventCategory parameter only accecpts 3 different values" { + (Get-Command $global:function).Parameters['eventCategory'].Attributes.Where{ $_ -is [ValidateSet] }.ValidValues.Count | Should -Be 3 + } + + It "eventCategory parameter accecpts 'All' as a Value" { + (Get-Command $global:function).Parameters['eventCategory'].Attributes.Where{ $_ -is [ValidateSet] }.ValidValues | Should -Contain 'All' + } + + It "eventCategory parameter accecpts 'events' as a Value" { + (Get-Command $global:function).Parameters['eventCategory'].Attributes.Where{ $_ -is [ValidateSet] }.ValidValues | Should -Contain 'events' + } + + It "eventCategory parameter accecpts 'alerts' as a Value" { + (Get-Command $global:function).Parameters['eventCategory'].Attributes.Where{ $_ -is [ValidateSet] }.ValidValues | Should -Contain 'alerts' + } + } + + Context "$global:function::Parameter Functional Tests" { + } -} \ No newline at end of file +} + +Remove-Variable -Name here -Scope Global +Remove-Variable -Name function -Scope Global diff --git a/Tests/Public/Get-ZertoLicense.Tests.ps1 b/Tests/Public/Get-ZertoLicense.Tests.ps1 index 50d2f9d..e3e16ee 100644 --- a/Tests/Public/Get-ZertoLicense.Tests.ps1 +++ b/Tests/Public/Get-ZertoLicense.Tests.ps1 @@ -1,19 +1,19 @@ #Requires -Modules Pester -$moduleFileName = "ZertoApiWrapper.psd1" -$here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper") -$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".") -$file = Get-ChildItem "$here\$sut" -$modulePath = $here -replace "Public", "" -$moduleFile = Get-ChildItem "$modulePath\$moduleFileName" -Get-Module -Name ZertoApiWrapper | Remove-Module -Force -Import-Module $moduleFile -Force +$global:here = (Split-Path -Parent $PSCommandPath) +$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0] -Describe $file.BaseName -Tag 'Unit' { +Describe $global:function -Tag 'Unit', 'Source', 'Built' { - It "is valid Powershell (Has no script errors)" { - $contents = Get-Content -Path $file -ErrorAction Stop - $errors = $null - $null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors) - $errors | Should -HaveCount 0 + Context "$global:function::Parameter Unit Tests" { + It "$global:function should have exactly 11 parameters defined" { + (Get-Command $global:function).Parameters.Count | Should -Be 11 + } } -} \ No newline at end of file + + Context "$global:function::Parameter Functional Tests" { + + } +} + +Remove-Variable -Name here -Scope Global +Remove-Variable -Name function -Scope Global diff --git a/Tests/Public/Get-ZertoLocalSite.Tests.ps1 b/Tests/Public/Get-ZertoLocalSite.Tests.ps1 index 50d2f9d..b82e8a6 100644 --- a/Tests/Public/Get-ZertoLocalSite.Tests.ps1 +++ b/Tests/Public/Get-ZertoLocalSite.Tests.ps1 @@ -1,19 +1,24 @@ #Requires -Modules Pester -$moduleFileName = "ZertoApiWrapper.psd1" -$here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper") -$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".") -$file = Get-ChildItem "$here\$sut" -$modulePath = $here -replace "Public", "" -$moduleFile = Get-ChildItem "$modulePath\$moduleFileName" -Get-Module -Name ZertoApiWrapper | Remove-Module -Force -Import-Module $moduleFile -Force +$global:here = (Split-Path -Parent $PSCommandPath) +$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0] -Describe $file.BaseName -Tag 'Unit' { +Describe $global:function -Tag 'Unit', 'Source', 'Built' { - It "is valid Powershell (Has no script errors)" { - $contents = Get-Content -Path $file -ErrorAction Stop - $errors = $null - $null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors) - $errors | Should -HaveCount 0 + Context "$global:function::Parameter Unit Tests" { + It "$global:function should have exactly 12 parameters defined" { + (Get-Command $global:function).Parameters.Count | Should -Be 12 + } + + It "Has a non-mandatory switch parameter for the pairing Statuses" { + Get-Command $global:function | Should -HaveParameter pairingstatuses + Get-Command $global:function | Should -HaveParameter pairingstatuses -Type switch + } } -} \ No newline at end of file + + Context "$global:function::Parameter Functional Tests" { + + } +} + +Remove-Variable -Name here -Scope Global +Remove-Variable -Name function -Scope Global diff --git a/Tests/Public/Get-ZertoPeerSite.Tests.ps1 b/Tests/Public/Get-ZertoPeerSite.Tests.ps1 index 50d2f9d..16ab624 100644 --- a/Tests/Public/Get-ZertoPeerSite.Tests.ps1 +++ b/Tests/Public/Get-ZertoPeerSite.Tests.ps1 @@ -1,19 +1,53 @@ #Requires -Modules Pester -$moduleFileName = "ZertoApiWrapper.psd1" -$here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper") -$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".") -$file = Get-ChildItem "$here\$sut" -$modulePath = $here -replace "Public", "" -$moduleFile = Get-ChildItem "$modulePath\$moduleFileName" -Get-Module -Name ZertoApiWrapper | Remove-Module -Force -Import-Module $moduleFile -Force - -Describe $file.BaseName -Tag 'Unit' { - - It "is valid Powershell (Has no script errors)" { - $contents = Get-Content -Path $file -ErrorAction Stop - $errors = $null - $null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors) - $errors | Should -HaveCount 0 +$global:here = (Split-Path -Parent $PSCommandPath) +$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0] + +Describe $global:function -Tag 'Unit', 'Source', 'Built' { + + Context "$global:function::Parameter Unit Tests" { + It "$global:function should have exactly 18 parameters defined" { + (Get-Command $global:function).Parameters.Count | Should -Be 18 + } + + $ParameterTestCases = @( + @{ParameterName = 'pairingStatuses'; Type = 'Switch'; Mandatory = $true; Validation = $null } + @{ParameterName = 'siteIdentifier'; Type = 'String[]'; Mandatory = $true; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'peerName'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'paringStatus'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'location'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'hostName'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'port'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } + ) + + It " parameter is of type" -TestCases $ParameterTestCases { + param($ParameterName, $Type, $Mandatory, $Validation) + Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type + } + + It " parameter has correct validation setting" -TestCases $ParameterTestCases { + param($ParameterName, $Validation) + Switch ($Validation) { + 'NotNullOrEmpty' { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1 + } + + $null { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.TypeId.Count | Should -Be 2 + } + + default { + $true | Should -Be $false -Because "No Validation Selected. Review test cases" + } + } + } } -} \ No newline at end of file + + Context "$global:function::Parameter Functional Tests" { + + } +} + +Remove-Variable -Name here -Scope Global +Remove-Variable -Name function -Scope Global diff --git a/Tests/Public/Get-ZertoProtectedVm.Tests.ps1 b/Tests/Public/Get-ZertoProtectedVm.Tests.ps1 index 50d2f9d..770482b 100644 --- a/Tests/Public/Get-ZertoProtectedVm.Tests.ps1 +++ b/Tests/Public/Get-ZertoProtectedVm.Tests.ps1 @@ -1,19 +1,17 @@ #Requires -Modules Pester -$moduleFileName = "ZertoApiWrapper.psd1" -$here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper") -$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".") -$file = Get-ChildItem "$here\$sut" -$modulePath = $here -replace "Public", "" -$moduleFile = Get-ChildItem "$modulePath\$moduleFileName" -Get-Module -Name ZertoApiWrapper | Remove-Module -Force -Import-Module $moduleFile -Force +$global:here = (Split-Path -Parent $PSCommandPath) +$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0] -Describe $file.BaseName -Tag 'Unit' { +Describe $global:function -Tag 'Unit', 'Source', 'Built' { + + Context "$global:function::Parameter Unit Tests" { - It "is valid Powershell (Has no script errors)" { - $contents = Get-Content -Path $file -ErrorAction Stop - $errors = $null - $null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors) - $errors | Should -HaveCount 0 } -} \ No newline at end of file + + Context "$global:function::Parameter Functional Tests" { + + } +} + +Remove-Variable -Name here -Scope Global +Remove-Variable -Name function -Scope Global diff --git a/Tests/Public/Get-ZertoRecoveryReport.Tests.ps1 b/Tests/Public/Get-ZertoRecoveryReport.Tests.ps1 index 50d2f9d..770482b 100644 --- a/Tests/Public/Get-ZertoRecoveryReport.Tests.ps1 +++ b/Tests/Public/Get-ZertoRecoveryReport.Tests.ps1 @@ -1,19 +1,17 @@ #Requires -Modules Pester -$moduleFileName = "ZertoApiWrapper.psd1" -$here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper") -$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".") -$file = Get-ChildItem "$here\$sut" -$modulePath = $here -replace "Public", "" -$moduleFile = Get-ChildItem "$modulePath\$moduleFileName" -Get-Module -Name ZertoApiWrapper | Remove-Module -Force -Import-Module $moduleFile -Force +$global:here = (Split-Path -Parent $PSCommandPath) +$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0] -Describe $file.BaseName -Tag 'Unit' { +Describe $global:function -Tag 'Unit', 'Source', 'Built' { + + Context "$global:function::Parameter Unit Tests" { - It "is valid Powershell (Has no script errors)" { - $contents = Get-Content -Path $file -ErrorAction Stop - $errors = $null - $null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors) - $errors | Should -HaveCount 0 } -} \ No newline at end of file + + Context "$global:function::Parameter Functional Tests" { + + } +} + +Remove-Variable -Name here -Scope Global +Remove-Variable -Name function -Scope Global diff --git a/Tests/Public/Get-ZertoResourcesReport.Tests.ps1 b/Tests/Public/Get-ZertoResourcesReport.Tests.ps1 index 50d2f9d..770482b 100644 --- a/Tests/Public/Get-ZertoResourcesReport.Tests.ps1 +++ b/Tests/Public/Get-ZertoResourcesReport.Tests.ps1 @@ -1,19 +1,17 @@ #Requires -Modules Pester -$moduleFileName = "ZertoApiWrapper.psd1" -$here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper") -$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".") -$file = Get-ChildItem "$here\$sut" -$modulePath = $here -replace "Public", "" -$moduleFile = Get-ChildItem "$modulePath\$moduleFileName" -Get-Module -Name ZertoApiWrapper | Remove-Module -Force -Import-Module $moduleFile -Force +$global:here = (Split-Path -Parent $PSCommandPath) +$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0] -Describe $file.BaseName -Tag 'Unit' { +Describe $global:function -Tag 'Unit', 'Source', 'Built' { + + Context "$global:function::Parameter Unit Tests" { - It "is valid Powershell (Has no script errors)" { - $contents = Get-Content -Path $file -ErrorAction Stop - $errors = $null - $null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors) - $errors | Should -HaveCount 0 } -} \ No newline at end of file + + Context "$global:function::Parameter Functional Tests" { + + } +} + +Remove-Variable -Name here -Scope Global +Remove-Variable -Name function -Scope Global diff --git a/Tests/Public/Get-ZertoServiceProfile.Tests.ps1 b/Tests/Public/Get-ZertoServiceProfile.Tests.ps1 index 50d2f9d..770482b 100644 --- a/Tests/Public/Get-ZertoServiceProfile.Tests.ps1 +++ b/Tests/Public/Get-ZertoServiceProfile.Tests.ps1 @@ -1,19 +1,17 @@ #Requires -Modules Pester -$moduleFileName = "ZertoApiWrapper.psd1" -$here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper") -$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".") -$file = Get-ChildItem "$here\$sut" -$modulePath = $here -replace "Public", "" -$moduleFile = Get-ChildItem "$modulePath\$moduleFileName" -Get-Module -Name ZertoApiWrapper | Remove-Module -Force -Import-Module $moduleFile -Force +$global:here = (Split-Path -Parent $PSCommandPath) +$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0] -Describe $file.BaseName -Tag 'Unit' { +Describe $global:function -Tag 'Unit', 'Source', 'Built' { + + Context "$global:function::Parameter Unit Tests" { - It "is valid Powershell (Has no script errors)" { - $contents = Get-Content -Path $file -ErrorAction Stop - $errors = $null - $null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors) - $errors | Should -HaveCount 0 } -} \ No newline at end of file + + Context "$global:function::Parameter Functional Tests" { + + } +} + +Remove-Variable -Name here -Scope Global +Remove-Variable -Name function -Scope Global diff --git a/Tests/Public/Get-ZertoTask.Tests.ps1 b/Tests/Public/Get-ZertoTask.Tests.ps1 index 50d2f9d..770482b 100644 --- a/Tests/Public/Get-ZertoTask.Tests.ps1 +++ b/Tests/Public/Get-ZertoTask.Tests.ps1 @@ -1,19 +1,17 @@ #Requires -Modules Pester -$moduleFileName = "ZertoApiWrapper.psd1" -$here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper") -$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".") -$file = Get-ChildItem "$here\$sut" -$modulePath = $here -replace "Public", "" -$moduleFile = Get-ChildItem "$modulePath\$moduleFileName" -Get-Module -Name ZertoApiWrapper | Remove-Module -Force -Import-Module $moduleFile -Force +$global:here = (Split-Path -Parent $PSCommandPath) +$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0] -Describe $file.BaseName -Tag 'Unit' { +Describe $global:function -Tag 'Unit', 'Source', 'Built' { + + Context "$global:function::Parameter Unit Tests" { - It "is valid Powershell (Has no script errors)" { - $contents = Get-Content -Path $file -ErrorAction Stop - $errors = $null - $null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors) - $errors | Should -HaveCount 0 } -} \ No newline at end of file + + Context "$global:function::Parameter Functional Tests" { + + } +} + +Remove-Variable -Name here -Scope Global +Remove-Variable -Name function -Scope Global diff --git a/Tests/Public/Get-ZertoUnprotectedVm.Tests.ps1 b/Tests/Public/Get-ZertoUnprotectedVm.Tests.ps1 index 50d2f9d..770482b 100644 --- a/Tests/Public/Get-ZertoUnprotectedVm.Tests.ps1 +++ b/Tests/Public/Get-ZertoUnprotectedVm.Tests.ps1 @@ -1,19 +1,17 @@ #Requires -Modules Pester -$moduleFileName = "ZertoApiWrapper.psd1" -$here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper") -$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".") -$file = Get-ChildItem "$here\$sut" -$modulePath = $here -replace "Public", "" -$moduleFile = Get-ChildItem "$modulePath\$moduleFileName" -Get-Module -Name ZertoApiWrapper | Remove-Module -Force -Import-Module $moduleFile -Force +$global:here = (Split-Path -Parent $PSCommandPath) +$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0] -Describe $file.BaseName -Tag 'Unit' { +Describe $global:function -Tag 'Unit', 'Source', 'Built' { + + Context "$global:function::Parameter Unit Tests" { - It "is valid Powershell (Has no script errors)" { - $contents = Get-Content -Path $file -ErrorAction Stop - $errors = $null - $null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors) - $errors | Should -HaveCount 0 } -} \ No newline at end of file + + Context "$global:function::Parameter Functional Tests" { + + } +} + +Remove-Variable -Name here -Scope Global +Remove-Variable -Name function -Scope Global diff --git a/Tests/Public/Get-ZertoVirtualizationSite.Tests.ps1 b/Tests/Public/Get-ZertoVirtualizationSite.Tests.ps1 index 50d2f9d..100a482 100644 --- a/Tests/Public/Get-ZertoVirtualizationSite.Tests.ps1 +++ b/Tests/Public/Get-ZertoVirtualizationSite.Tests.ps1 @@ -1,19 +1,261 @@ #Requires -Modules Pester -$moduleFileName = "ZertoApiWrapper.psd1" -$here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper") -$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".") -$file = Get-ChildItem "$here\$sut" -$modulePath = $here -replace "Public", "" -$moduleFile = Get-ChildItem "$modulePath\$moduleFileName" -Get-Module -Name ZertoApiWrapper | Remove-Module -Force -Import-Module $moduleFile -Force - -Describe $file.BaseName -Tag 'Unit' { - - It "is valid Powershell (Has no script errors)" { - $contents = Get-Content -Path $file -ErrorAction Stop - $errors = $null - $null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors) - $errors | Should -HaveCount 0 +$global:here = (Split-Path -Parent $PSCommandPath) +$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0] + +Describe $global:function -Tag 'Unit', 'Source', 'Built' { + BeforeAll { + $script:ScriptBlock = (Get-Command $global:function).ScriptBlock + } + + Context "$global:function::Parameter Unit Tests" { + It "$global:function should have exactly 23 parameters defined" { + (Get-Command $global:function).Parameters.Count | Should -Be 23 + } + + $ParameterTestCases = @( + @{ParameterName = 'siteIdentifier'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'hostIdentifier'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'folders'; Type = 'Switch'; Mandatory = $true; Validation = $Null } + @{ParameterName = 'hostClusters'; Type = 'Switch'; Mandatory = $true; Validation = $Null } + @{ParameterName = 'hosts'; Type = 'Switch'; Mandatory = $true; Validation = $Null } + @{ParameterName = 'networks'; Type = 'Switch'; Mandatory = $true; Validation = $Null } + @{ParameterName = 'resourcePools'; Type = 'Switch'; Mandatory = $true; Validation = $Null } + @{ParameterName = 'vms'; Type = 'Switch'; Mandatory = $true; Validation = $Null } + @{ParameterName = 'repositories'; Type = 'Switch'; Mandatory = $true; Validation = $Null } + ) + + It " parameter is of type" -TestCases $ParameterTestCases { + param($ParameterName, $Type, $Mandatory) + Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type + } + + It " parameter has correct validation setting of " -TestCases $ParameterTestCases { + param($ParameterName, $Type, $Validation) + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + Switch ($Validation) { + + 'NotNullOrEmpty' { + $attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1 + } + + $Null { + $Type -match 'Switch' | Should -BeTrue -Because "Only Switch Parameters should not have validation" + } + + default { + $true | Should -BeFalse -Because "No Validation Selected. Review test cases" + } + + } + } + + It "$($global:function) does not have 'SupportsShouldProcess'" { + Get-Command $global:function | Should -not -HaveParameter WhatIf + Get-Command $global:function | Should -not -HaveParameter Confirm + $script:ScriptBlock | Should -not -match 'SupportsShouldProcess' + $script:ScriptBlock | Should -not -match '\$PSCmdlet\.ShouldProcess\(.+\)' + } + } -} \ No newline at end of file + + Context "$global:function::Parameter Functional Tests" { + Mock -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -ParameterFilter { + $uri -eq 'virtualizationsites' + } { + return (Get-Content "$global:here\Mocks\VirtualSite-NoParams.json" -Raw) | ConvertFrom-Json + } -Verifiable + Mock -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -ParameterFilter { + $uri -eq 'virtualizationsites/1234/devices' + } { + return (Get-Content "$global:here\Mocks\VirtualSite-devices.json" -Raw) | ConvertFrom-Json + } -Verifiable + Mock -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -ParameterFilter { + $uri -eq 'virtualizationsites/1234/devices?hostIdentifier=4567' + } { + return (Get-Content "$global:here\Mocks\VirtualSite-devices-hostid.json" -Raw) | ConvertFrom-Json + } -Verifiable + Mock -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -ParameterFilter { + $uri -eq 'virtualizationsites/1234/hosts' + } { + return (Get-Content "$global:here\Mocks\VirtualSite-hosts.json" -Raw) | ConvertFrom-Json + } -Verifiable + Mock -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -ParameterFilter { + $uri -eq 'virtualizationsites/1234/hosts/4567' + } { + return (Get-Content "$global:here\Mocks\VirtualSite-hosts-hostid.json" -Raw) | ConvertFrom-Json + } -Verifiable + Mock -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -ParameterFilter { + $uri -eq 'virtualizationsites/1234' + } { + return (Get-Content "$global:here\Mocks\VirtualSite-SiteId.json" -Raw) | ConvertFrom-Json + } -Verifiable + Mock -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -ParameterFilter { + $uri -eq 'virtualizationsites/1234/datastores' + } { + return (Get-Content "$global:here\Mocks\VirtualSite-datastores.json" -Raw) | ConvertFrom-Json + } -Verifiable + Mock -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -ParameterFilter { + $uri -eq 'virtualizationsites/1234/datastoreclusters' + } { + return (Get-Content "$global:here\Mocks\VirtualSite-datastoreClusters.json" -Raw) | ConvertFrom-Json + } -Verifiable + Mock -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -ParameterFilter { + $uri -eq 'virtualizationsites/1234/networks' + } { + return (Get-Content "$global:here\Mocks\VirtualSite-Networks.json" -Raw) | ConvertFrom-Json + } -Verifiable + Mock -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -ParameterFilter { + $uri -eq 'virtualizationsites/1234/folders' + } { + return (Get-Content "$global:here\Mocks\VirtualSite-Folders.json" -Raw) | ConvertFrom-Json + } -Verifiable + Mock -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -ParameterFilter { + $uri -eq 'virtualizationsites/1234/hostclusters' + } { + return (Get-Content "$global:here\Mocks\VirtualSite-hostClusters.json" -Raw) | ConvertFrom-Json + } -Verifiable + Mock -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -ParameterFilter { + $uri -eq 'virtualizationsites/1234/resourcepools' + } { + return (Get-Content "$global:here\Mocks\VirtualSite-ResourcePools.json" -Raw) | ConvertFrom-Json + } -Verifiable + Mock -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -ParameterFilter { + $uri -eq 'virtualizationsites/1234/vms' + } { + return (Get-Content "$global:here\Mocks\VirtualSite-VMs.json" -Raw) | ConvertFrom-Json + } -Verifiable + Mock -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -ParameterFilter { + $uri -eq 'virtualizationsites/1234/repositories' + } { + return (Get-Content "$global:here\Mocks\VirtualSite-repositories.json" -Raw) | ConvertFrom-Json + } -Verifiable + + It "Should return all known sites when called without parameters" { + $results = Get-ZertoVirtualizationSite + $results.Count | Should -BeExactly 2 + } + + It "Should return a single site when a siteIdentifier is provided" { + $results = Get-ZertoVirtualizationSite -siteIdentifier '1234' + $results.VirtualizationSiteName | Should -BeExactly 'cavc.nc.lab' + $results.siteIdentifier | Should -BeExactly '8e1c9f53-4973-4a4a-b2dd-1ebb293614d8' + } + + It "Should return a list of devices with the '-devices' switch" { + $results = Get-ZertoVirtualizationSite -siteIdentifier '1234' -devices + $results.Count | Should -BeExactly 5 + } + + It "Should return a list of devices with the '-devices' switch and hostIdentifier provided" { + $results = Get-ZertoVirtualizationSite -siteIdentifier '1234' -devices -hostIdentifier '4567' + $results.Count | Should -BeExactly 5 + } + + It "Should return a list of hosts with the '-hosts' switch" { + $results = Get-ZertoVirtualizationSite -siteIdentifier '1234' -hosts + $results.Count | Should -BeExactly 3 + } + + It "Should return a single host with the '-hosts' switch and hostIdentifier provided" { + $results = Get-ZertoVirtualizationSite -siteIdentifier '1234' -hosts -hostIdentifier '4567' + $results.VirtualizationHostName | Should -BeExactly "caesx3.nc.lab" + $results.hostIdentifier | Should -BeExactly "09db6c5b-b956-430f-9589-b58876ca377a.host-18" + } + + It "Should return a list of datastores with the '-datastores' switch" { + $results = Get-ZertoVirtualizationSite -siteIdentifier '1234' -datastores + $results.Count | Should -BeExactly 8 + } + + It "Should return a list of datastores with the '-datastoreClusters' switch" { + $results = Get-ZertoVirtualizationSite -siteIdentifier '1234' -datastoreClusters + $results.DatastoreClusterIdentifier | Should -BeExactly "09db6c5b-b956-430f-9589-b58876ca377a.group-p44" + $results.DatastoreClusterName | Should -BeExactly "CA_DS_Cluster" + } + + It "Should return a list of Networks with the '-networks' switch" { + $results = Get-ZertoVirtualizationSite -siteIdentifier '1234' -networks + $results.NetworkIdentifier | Should -BeExactly "09db6c5b-b956-430f-9589-b58876ca377a.network-20" + $results.VirtualizationNetworkName | Should -BeExactly "VM Network" + } + + It "Should return a list of folders with the '-folders' switch" { + $results = Get-ZertoVirtualizationSite -siteIdentifier '1234' -folders + $results.Count | Should -BeExactly 3 + } + + It "Should return a list of Host Clusters with the '-hostClusters' switch" { + $results = Get-ZertoVirtualizationSite -siteIdentifier '1234' -hostClusters + $results.ClusterIdentifier | Should -BeExactly "09db6c5b-b956-430f-9589-b58876ca377a.domain-c7" + $results.VirtualizationClusterName | Should -BeExactly "CA Cluster" + } + + It "Should return a list of Resource Pools with the '-resourcePools' switch" { + $results = Get-ZertoVirtualizationSite -siteIdentifier '1234' -resourcePools + $results.ResourcePoolIdentifier | Should -BeExactly "09db6c5b-b956-430f-9589-b58876ca377a.resgroup-8" + $results.ResourcePoolName | Should -BeExactly "Resources" + } + + It "Should return a list of VMs with the '-VMs' switch" { + $results = Get-ZertoVirtualizationSite -siteIdentifier '1234' -vms + $results.Count | Should -BeExactly 4 + } + + It "Should return a list of LTR Repositories with the '-repositories' switch" { + $results = Get-ZertoVirtualizationSite -siteIdentifier '1234' -repositories + $results.ConnectionType | Should -BeExactly "ServerMessageBlock" + $results.RepositoryIdentifier | Should -BeExactly "120355ce-fcd0-4820-a971-787d0470793b" + $results.RepositoryName | Should -BeExactly "Synology" + $results.StorageType | Should -BeExactly "NetworkShare" + $results.Path | Should -not -be $null + } + + Assert-VerifiableMock + + Assert-MockCalled -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -ParameterFilter { + $uri -eq 'virtualizationsites' + } -Exactly 1 + Assert-MockCalled -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -ParameterFilter { + $uri -eq 'virtualizationsites/1234' + } -Exactly 1 + Assert-MockCalled -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -ParameterFilter { + $uri -eq 'virtualizationsites/1234/devices' + } -Exactly 1 + Assert-MockCalled -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -ParameterFilter { + $uri -eq 'virtualizationsites/1234/devices?hostIdentifier=4567' + } -Exactly 1 + Assert-MockCalled -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -ParameterFilter { + $uri -eq 'virtualizationsites/1234/hosts' + } -Exactly 1 + Assert-MockCalled -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -ParameterFilter { + $uri -eq 'virtualizationsites/1234/hosts/4567' + } -Exactly 1 + Assert-MockCalled -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -ParameterFilter { + $uri -eq 'virtualizationsites/1234/datastores' + } -Exactly 1 + Assert-MockCalled -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -ParameterFilter { + $uri -eq 'virtualizationsites/1234/datastoreclusters' + } -Exactly 1 + Assert-MockCalled -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -ParameterFilter { + $uri -eq 'virtualizationsites/1234/networks' + } -Exactly 1 + Assert-MockCalled -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -ParameterFilter { + $uri -eq 'virtualizationsites/1234/folders' + } -Exactly 1 + Assert-MockCalled -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -ParameterFilter { + $uri -eq 'virtualizationsites/1234/hostclusters' + } -Exactly 1 + Assert-MockCalled -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -ParameterFilter { + $uri -eq 'virtualizationsites/1234/resourcepools' + } -Exactly 1 + Assert-MockCalled -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -ParameterFilter { + $uri -eq 'virtualizationsites/1234/vms' + } -Exactly 1 + Assert-MockCalled -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -ParameterFilter { + $uri -eq 'virtualizationsites/1234/repositories' + } -Exactly 1 + } +} + +Remove-Variable -Name here -Scope Global +Remove-Variable -Name function -Scope Global diff --git a/Tests/Public/Get-ZertoVolume.Tests.ps1 b/Tests/Public/Get-ZertoVolume.Tests.ps1 index 50d2f9d..a46cda1 100644 --- a/Tests/Public/Get-ZertoVolume.Tests.ps1 +++ b/Tests/Public/Get-ZertoVolume.Tests.ps1 @@ -1,19 +1,18 @@ #Requires -Modules Pester -$moduleFileName = "ZertoApiWrapper.psd1" -$here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper") -$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".") -$file = Get-ChildItem "$here\$sut" -$modulePath = $here -replace "Public", "" -$moduleFile = Get-ChildItem "$modulePath\$moduleFileName" -Get-Module -Name ZertoApiWrapper | Remove-Module -Force -Import-Module $moduleFile -Force +$global:here = (Split-Path -Parent $PSCommandPath) +$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0] -Describe $file.BaseName -Tag 'Unit' { +Describe $global:function -Tag 'Unit', 'Source', 'Built' { + + Context "$global:function::Parameter Unit Tests" { + + } + + Context "$global:function::Parameter Functional Tests" { - It "is valid Powershell (Has no script errors)" { - $contents = Get-Content -Path $file -ErrorAction Stop - $errors = $null - $null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors) - $errors | Should -HaveCount 0 } -} \ No newline at end of file +} + +Remove-Variable -Name here -Scope Global +Remove-Variable -Name function -Scope Global + diff --git a/Tests/Public/Get-ZertoVpg.Tests.ps1 b/Tests/Public/Get-ZertoVpg.Tests.ps1 index 50d2f9d..770482b 100644 --- a/Tests/Public/Get-ZertoVpg.Tests.ps1 +++ b/Tests/Public/Get-ZertoVpg.Tests.ps1 @@ -1,19 +1,17 @@ #Requires -Modules Pester -$moduleFileName = "ZertoApiWrapper.psd1" -$here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper") -$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".") -$file = Get-ChildItem "$here\$sut" -$modulePath = $here -replace "Public", "" -$moduleFile = Get-ChildItem "$modulePath\$moduleFileName" -Get-Module -Name ZertoApiWrapper | Remove-Module -Force -Import-Module $moduleFile -Force +$global:here = (Split-Path -Parent $PSCommandPath) +$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0] -Describe $file.BaseName -Tag 'Unit' { +Describe $global:function -Tag 'Unit', 'Source', 'Built' { + + Context "$global:function::Parameter Unit Tests" { - It "is valid Powershell (Has no script errors)" { - $contents = Get-Content -Path $file -ErrorAction Stop - $errors = $null - $null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors) - $errors | Should -HaveCount 0 } -} \ No newline at end of file + + Context "$global:function::Parameter Functional Tests" { + + } +} + +Remove-Variable -Name here -Scope Global +Remove-Variable -Name function -Scope Global diff --git a/Tests/Public/Get-ZertoVpgSetting.Tests.ps1 b/Tests/Public/Get-ZertoVpgSetting.Tests.ps1 index 50d2f9d..770482b 100644 --- a/Tests/Public/Get-ZertoVpgSetting.Tests.ps1 +++ b/Tests/Public/Get-ZertoVpgSetting.Tests.ps1 @@ -1,19 +1,17 @@ #Requires -Modules Pester -$moduleFileName = "ZertoApiWrapper.psd1" -$here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper") -$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".") -$file = Get-ChildItem "$here\$sut" -$modulePath = $here -replace "Public", "" -$moduleFile = Get-ChildItem "$modulePath\$moduleFileName" -Get-Module -Name ZertoApiWrapper | Remove-Module -Force -Import-Module $moduleFile -Force +$global:here = (Split-Path -Parent $PSCommandPath) +$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0] -Describe $file.BaseName -Tag 'Unit' { +Describe $global:function -Tag 'Unit', 'Source', 'Built' { + + Context "$global:function::Parameter Unit Tests" { - It "is valid Powershell (Has no script errors)" { - $contents = Get-Content -Path $file -ErrorAction Stop - $errors = $null - $null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors) - $errors | Should -HaveCount 0 } -} \ No newline at end of file + + Context "$global:function::Parameter Functional Tests" { + + } +} + +Remove-Variable -Name here -Scope Global +Remove-Variable -Name function -Scope Global diff --git a/Tests/Public/Get-ZertoVra.Tests.ps1 b/Tests/Public/Get-ZertoVra.Tests.ps1 index 50d2f9d..770482b 100644 --- a/Tests/Public/Get-ZertoVra.Tests.ps1 +++ b/Tests/Public/Get-ZertoVra.Tests.ps1 @@ -1,19 +1,17 @@ #Requires -Modules Pester -$moduleFileName = "ZertoApiWrapper.psd1" -$here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper") -$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".") -$file = Get-ChildItem "$here\$sut" -$modulePath = $here -replace "Public", "" -$moduleFile = Get-ChildItem "$modulePath\$moduleFileName" -Get-Module -Name ZertoApiWrapper | Remove-Module -Force -Import-Module $moduleFile -Force +$global:here = (Split-Path -Parent $PSCommandPath) +$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0] -Describe $file.BaseName -Tag 'Unit' { +Describe $global:function -Tag 'Unit', 'Source', 'Built' { + + Context "$global:function::Parameter Unit Tests" { - It "is valid Powershell (Has no script errors)" { - $contents = Get-Content -Path $file -ErrorAction Stop - $errors = $null - $null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors) - $errors | Should -HaveCount 0 } -} \ No newline at end of file + + Context "$global:function::Parameter Functional Tests" { + + } +} + +Remove-Variable -Name here -Scope Global +Remove-Variable -Name function -Scope Global diff --git a/Tests/Public/Get-ZertoZorg.Tests.ps1 b/Tests/Public/Get-ZertoZorg.Tests.ps1 index 50d2f9d..770482b 100644 --- a/Tests/Public/Get-ZertoZorg.Tests.ps1 +++ b/Tests/Public/Get-ZertoZorg.Tests.ps1 @@ -1,19 +1,17 @@ #Requires -Modules Pester -$moduleFileName = "ZertoApiWrapper.psd1" -$here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper") -$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".") -$file = Get-ChildItem "$here\$sut" -$modulePath = $here -replace "Public", "" -$moduleFile = Get-ChildItem "$modulePath\$moduleFileName" -Get-Module -Name ZertoApiWrapper | Remove-Module -Force -Import-Module $moduleFile -Force +$global:here = (Split-Path -Parent $PSCommandPath) +$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0] -Describe $file.BaseName -Tag 'Unit' { +Describe $global:function -Tag 'Unit', 'Source', 'Built' { + + Context "$global:function::Parameter Unit Tests" { - It "is valid Powershell (Has no script errors)" { - $contents = Get-Content -Path $file -ErrorAction Stop - $errors = $null - $null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors) - $errors | Should -HaveCount 0 } -} \ No newline at end of file + + Context "$global:function::Parameter Functional Tests" { + + } +} + +Remove-Variable -Name here -Scope Global +Remove-Variable -Name function -Scope Global diff --git a/Tests/Public/Get-ZertoZsspSession.Tests.ps1 b/Tests/Public/Get-ZertoZsspSession.Tests.ps1 index 50d2f9d..770482b 100644 --- a/Tests/Public/Get-ZertoZsspSession.Tests.ps1 +++ b/Tests/Public/Get-ZertoZsspSession.Tests.ps1 @@ -1,19 +1,17 @@ #Requires -Modules Pester -$moduleFileName = "ZertoApiWrapper.psd1" -$here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper") -$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".") -$file = Get-ChildItem "$here\$sut" -$modulePath = $here -replace "Public", "" -$moduleFile = Get-ChildItem "$modulePath\$moduleFileName" -Get-Module -Name ZertoApiWrapper | Remove-Module -Force -Import-Module $moduleFile -Force +$global:here = (Split-Path -Parent $PSCommandPath) +$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0] -Describe $file.BaseName -Tag 'Unit' { +Describe $global:function -Tag 'Unit', 'Source', 'Built' { + + Context "$global:function::Parameter Unit Tests" { - It "is valid Powershell (Has no script errors)" { - $contents = Get-Content -Path $file -ErrorAction Stop - $errors = $null - $null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors) - $errors | Should -HaveCount 0 } -} \ No newline at end of file + + Context "$global:function::Parameter Functional Tests" { + + } +} + +Remove-Variable -Name here -Scope Global +Remove-Variable -Name function -Scope Global diff --git a/Tests/Public/Import-ZertoVmNicSetting.Tests.ps1 b/Tests/Public/Import-ZertoVmNicSetting.Tests.ps1 new file mode 100644 index 0000000..20db68c --- /dev/null +++ b/Tests/Public/Import-ZertoVmNicSetting.Tests.ps1 @@ -0,0 +1,30 @@ +#Requires -Modules Pester +$global:here = (Split-Path -Parent $PSCommandPath) +$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0] + +Describe $global:function -Tag 'Unit', 'Source', 'Built' { + + Context "$global:function::Parameter Unit Tests" { + It "$global:function should have exactly 11 parameters defined" { + (Get-Command $global:function).Parameters.Count | Should -Be 14 + } + + It "Has a mandatory string array parameter for the settings file to import" { + Get-Command $global:function | Should -HaveParameter InputFile + Get-Command $global:function | Should -HaveParameter InputFile -Mandatory + Get-Command $global:function | Should -HaveParameter InputFile -Type String + } + + It "Will not accecpt a Null or Empty string for the settings file" { + $attrs = (Get-Command $global:function).Parameters['InputFile'].Attributes + $attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1 + } + } + + Context "$global:function::Parameter Functional Tests" { + + } +} + +Remove-Variable -Name here -Scope Global +Remove-Variable -Name function -Scope Global diff --git a/Tests/Public/Import-ZertoVpg.Tests.ps1 b/Tests/Public/Import-ZertoVpg.Tests.ps1 index bd91e77..6b48c30 100644 --- a/Tests/Public/Import-ZertoVpg.Tests.ps1 +++ b/Tests/Public/Import-ZertoVpg.Tests.ps1 @@ -1,39 +1,30 @@ #Requires -Modules Pester -$moduleFileName = "ZertoApiWrapper.psd1" -$here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper") -$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".") -$file = Get-ChildItem "$here\$sut" -$modulePath = $here -replace "Public", "" -$moduleFile = Get-ChildItem "$modulePath\$moduleFileName" -Get-Module -Name ZertoApiWrapper | Remove-Module -Force -Import-Module $moduleFile -Force +$global:here = (Split-Path -Parent $PSCommandPath) +$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0] -Describe $file.BaseName -Tag 'Unit' { +Describe $global:function -Tag 'Unit', 'Source', 'Built' { - It "is valid Powershell (Has no script errors)" { - $contents = Get-Content -Path $file -ErrorAction Stop - $errors = $null - $null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors) - $errors | Should -HaveCount 0 - } - - Context "$($file.BaseName)::Parameter Unit Tests" { + Context "$global:function::Parameter Unit Tests" { + It "$global:function should have exactly 12 parameters defined" { + (Get-Command $global:function).Parameters.Count | Should -Be 12 + } It "Has a mandatory string array parameter for the settings file to import" { - Get-Command $file.BaseName | Should -HaveParameter settingsFile - Get-Command $file.BaseName | Should -HaveParameter settingsFile -Mandatory - Get-Command $file.BaseName | Should -HaveParameter settingsFile -Type String[] + Get-Command $global:function | Should -HaveParameter settingsFile + Get-Command $global:function | Should -HaveParameter settingsFile -Mandatory + Get-Command $global:function | Should -HaveParameter settingsFile -Type String[] } It "Will not accecpt a Null or Empty string for the settings file" { - {Import-ZertoVpg -settingsFile $null} | Should -Throw - {Import-ZertoVpg -settingsFile ""} | Should -Throw - {Import-ZertoVpg -settingsFile @()} | Should -Throw + $attrs = (Get-Command $global:function).Parameters['settingsFile'].Attributes + $attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1 } - } - Context "$($file.BaseName)::Function Unit Tests" { + Context "$global:function::Parameter Functional Tests" { } } + +Remove-Variable -Name here -Scope Global +Remove-Variable -Name function -Scope Global diff --git a/Tests/Public/Install-ZertoVra.Tests.ps1 b/Tests/Public/Install-ZertoVra.Tests.ps1 index 598a6e4..a5005d3 100644 --- a/Tests/Public/Install-ZertoVra.Tests.ps1 +++ b/Tests/Public/Install-ZertoVra.Tests.ps1 @@ -1,108 +1,57 @@ #Requires -Modules Pester -$moduleFileName = "ZertoApiWrapper.psd1" -$here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper") -$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".") -$file = Get-ChildItem "$here\$sut" -$modulePath = $here -replace "Public", "" -$moduleFile = Get-ChildItem "$modulePath\$moduleFileName" -Get-Module -Name ZertoApiWrapper | Remove-Module -Force -Import-Module $moduleFile -Force - -Describe $file.BaseName -Tag 'Unit' { - - It "is valid Powershell (Has no script errors)" { - $contents = Get-Content -Path $file -ErrorAction Stop - $errors = $null - $null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors) - $errors | Should -HaveCount 0 - } - - Context "$($file.BaseName)::Parameter Unit Tests" { - - It "Has a mandatory string host name parameter" { - Get-Command $file.BaseName | Should -HaveParameter hostName - Get-Command $file.BaseName | Should -HaveParameter hostName -Mandatory - Get-Command $file.BaseName | Should -HaveParameter hostName -Type String - } - - It "Will not accecpt a Null or Empty string for the host name" { - {Install-ZertoVra -hostName $null -datastoreName "DS01" -networkName "MyNetwork" -Dhcp } | Should -Throw "The argument is null or empty" - {Install-ZertoVra -hostName "" -datastoreName "DS01" -networkName "MyNetwork" -Dhcp } | Should -Throw "The argument is null or empty" - } - - It "Has a mandatory string datastore parameter" { - Get-Command $file.BaseName | Should -HaveParameter datastoreName - Get-Command $file.BaseName | Should -HaveParameter datastoreName -Mandatory - Get-Command $file.BaseName | Should -HaveParameter datastoreName -Type String +$global:here = (Split-Path -Parent $PSCommandPath) +$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0] + +Describe $global:function -Tag 'Unit', 'Source', 'Built' { + + Context "$global:function::Parameter Unit Tests" { + It "$global:function should have exactly 24 parameters defined" { + (Get-Command $global:function).Parameters.Count | Should -Be 24 + } + + $ParameterTestCases = @( + @{ParameterName = 'hostName'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'datastoreName'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'networkName'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'Dhcp'; Type = 'Switch'; Mandatory = $true; Validation = $null } + @{ParameterName = 'vraIpAddress'; Type = 'String'; Mandatory = $true; Validation = 'IpAddr' } + @{ParameterName = 'subnetMask'; Type = 'String'; Mandatory = $true; Validation = 'IpAddr' } + @{ParameterName = 'defaultGateway'; Type = 'String'; Mandatory = $true; Validation = 'IpAddr' } + @{ParameterName = 'UseRootCredential'; Type = 'Switch'; Mandatory = $true; Validation = $null } + @{ParameterName = 'HostRootPassword'; Type = 'SecureString'; Mandatory = $true; Validation = 'NotNullOrEmpty' } + ) + + It " parameter is of type" -TestCases $ParameterTestCases { + param($ParameterName, $Type, $Mandatory, $Validation) + Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type + } + + It " parameter has correct validation setting" -TestCases $ParameterTestCases { + param($ParameterName, $Validation) + Switch ($Validation) { + 'NotNullOrEmpty' { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1 + } + + 'IpAddr' { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.Where{ $_ -is [ValidateScript] }.Count | Should -Be 1 + $attrs.Where{ $_ -is [ValidateScript] }.ScriptBlock | Should -Match '\$_ \-match \[IPAddress\]\$_' + } + + $null { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.TypeId.Count | Should -Be 3 + } + } } - - It "Will not accecpt a Null or Empty string for the datastore" { - {Install-ZertoVra -hostName "MyfirstHost" -datastoreName $null -networkName "MyNetwork" -Dhcp } | Should -Throw "The argument is null or empty" - {Install-ZertoVra -hostName "MyfirstHost" -datastoreName "" -networkName "MyNetwork" -Dhcp } | Should -Throw "The argument is null or empty" - } - - It "Has a mandatory string network parameter" { - Get-Command $file.BaseName | Should -HaveParameter networkName - Get-Command $file.BaseName | Should -HaveParameter networkName -Mandatory - Get-Command $file.BaseName | Should -HaveParameter networkName -Type String - } - - It "Will not accecpt a Null or Empty string for the datastore" { - {Install-ZertoVra -hostName "MyfirstHost" -datastoreName "DS01" -networkName $null -Dhcp } | Should -Throw "The argument is null or empty" - {Install-ZertoVra -hostName "MyfirstHost" -datastoreName "DS01" -networkName "" -Dhcp } | Should -Throw "The argument is null or empty" - } - - it "Has a switch parameter for setting DHCP" { - Get-Command $file.BaseName | Should -HaveParameter Dhcp - Get-Command $file.BaseName | Should -HaveParameter Dhcp -Mandatory - Get-Command $file.BaseName | Should -HaveParameter Dhcp -Type 'Switch' - - } - - it "Has a mandatory string parameter for the static IP address" { - Get-Command $file.BaseName | Should -HaveParameter vraIpAddress - Get-Command $file.BaseName | Should -HaveParameter vraIpAddress -Mandatory - Get-Command $file.BaseName | Should -HaveParameter vraIpAddress -Type String - } - - it "Has a mandatory string parameter for the subnet mask" { - Get-Command $file.BaseName | Should -HaveParameter subnetMask - Get-Command $file.BaseName | Should -HaveParameter subnetMask -Mandatory - Get-Command $file.BaseName | Should -HaveParameter subnetMask -Type String - } - - it "Has a mandatory string parameter for the default gateway" { - Get-Command $file.BaseName | Should -HaveParameter defaultGateway - Get-Command $file.BaseName | Should -HaveParameter defaultGateway -Mandatory - Get-Command $file.BaseName | Should -HaveParameter defaultGateway -Type String - } - - $cases = ` - @{invalidIpAddress = "192.168.1.256"}, ` - @{invalidIpAddress = "192.168.1"}, ` - @{invalidIpAddress = "String"}, ` - @{invalidIpAddress = 192.168.1.246}, ` - @{invalidIpAddress = 32}, ` - @{invalidIpAddress = ""}, ` - @{invalidIpAddress = $null} - It "IpAddress field require valid IP addresses as a String: " -TestCases $cases { - param ( $invalidIpAddress ) - {Install-ZertoVra -hostName "MyFirstHost" -datastoreName "DS01" -networkName "MyNetwork" -vraIpAddress $invalidIpAddress -subnetMask "255.255.255.0" -defaultGateway "192.168.1.254"} | Should -Throw - } - - It "Default Gateway field require valid IP addresses as a String: " -TestCases $cases { - param ( $invalidIpAddress ) - {Install-ZertoVra -hostName "MyFirstHost" -datastoreName "DS01" -networkName "MyNetwork" -vraIpAddress '192.168.1.100' -subnetMask "255.255.255.0" -defaultGateway $invalidIpAddress} | Should -Throw - } - - It "Subnet Mask field require valid IP addresses as a String: " -TestCases $cases { - param ( $invalidIpAddress ) - {Install-ZertoVra -hostName "MyFirstHost" -datastoreName "DS01" -networkName "MyNetwork" -vraIpAddress '192.168.1.100' -subnetMask $invalidIpAddress -defaultGateway "192.168.1.254"} | Should -Throw - } - } - Context "$($file.BaseName)::Function Unit Tests" { - #TODO + Context "$global:function::Parameter Functional Tests" { + } } + +Remove-Variable -Name here -Scope Global +Remove-Variable -Name function -Scope Global diff --git a/Tests/Public/Invoke-ZARestRequest.Tests.ps1 b/Tests/Public/Invoke-ZARestRequest.Tests.ps1 new file mode 100644 index 0000000..983c373 --- /dev/null +++ b/Tests/Public/Invoke-ZARestRequest.Tests.ps1 @@ -0,0 +1,90 @@ +#Requires -Modules Pester +$global:here = (Split-Path -Parent $PSCommandPath) +$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0] + +Describe $global:function -Tag 'Unit', 'Source', 'Built' { + + InModuleScope -ModuleName ZertoApiWrapper { + + Context "$global:function::Parameter Unit Tests" { + + $testCases = @( + @{ParameterName = 'uri'; Type = 'String'; Mandatory = $true; TestName = 'URI' } + @{ParameterName = 'method'; Type = 'String'; Mandatory = $false; TestName = 'Method' } + @{ParameterName = 'body'; Type = 'String'; Mandatory = $false; TestName = 'Body' } + ) + + It "Parameter present and Type test for: " -TestCases $testCases { + param($parameterName, $type, $Mandatory) + Get-Command $global:function | Should -HaveParameter $parameterName -Type $type + if ($Mandatory) { + Get-Command $global:function | Should -HaveParameter $parameterName -Mandatory + } else { + Get-Command $global:function | Should -HaveParameter $parameterName -Not -Mandatory + } + } + + It "Method parameter default is 'GET'" { + Get-Command $global:function | Should -HaveParameter Method -DefaultValue "GET" + } + + $NotNullOrEmptyTests = @( + @{ParameterName = 'uri'; TestName = 'Uri' } + @{ParameterName = 'body'; TestName = 'Body' } + ) + + It " parameter does not accecpt a null or empty value" -TestCases $NotNullOrEmptyTests { + param($parameterName) + $parameterInfo = ( Get-Command Invoke-ZARestRequest ).Parameters[$parameterName] + $parameterInfo.Attributes.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1 + } + + It "method parametert only accecpts 'GET' 'DELETE' 'PUT' 'POST' values" { + $parameterInfo = ( Get-Command Invoke-ZARestRequest ).Parameters['method'] + $parameterInfo.Attributes.Where{ $_ -is [ValidateSet] }.Count | Should -Be 1 + $validateSet = $parameterInfo.Attributes.Where{ $_ -is [ValidateSet] } + $validateSet.ValidValues -contains 'GET' | Should -BeTrue + $validateSet.ValidValues -contains 'PUT' | Should -BeTrue + $validateSet.ValidValues -contains 'POST' | Should -BeTrue + $validateSet.ValidValues -contains 'DELETE' | Should -BeTrue + $validateSet.ValidValues.Count | Should -Be 4 + } + } + + Context "$global:function::Function Unit Tests" { + + Mock -ModuleName ZertoApiWrapper -CommandName Invoke-RestMethod { + "Ran Command" + } + + BeforeEach { + Set-Variable -Name zaHeaders -Scope Script -Value (@{ "Accept" = "application/json" }) + Set-Variable -Name zaLastActionTime -Scope Script -Value $(Get-Date).Ticks + } + + It "runs when called" { + Invoke-ZARestRequest -uri "myuri" | Should -Be "Ran Command" + } + + It "throws when the last action was over 60 minutes ago" { + $script:zaLastActionTime = (Get-Date).AddMinutes(-61).Ticks + { Invoke-ZARestRequest -uri "myuri" } | Should Throw "Authorization Token has Expired." + } + + It "throws when the zaHeaders variable does not exits" { + Remove-Variable -Name zaHeaders -Scope Script + { Invoke-ZARestRequest -uri "myuri" } | Should Throw "Zerto Analytics Connection does not Exist." + } + + It "throws when the zaLastActionTime variable does not exist" { + Remove-Variable -Name zaLastActionTime -Scope Script + { Invoke-ZARestRequest -uri "myuri" } | Should Throw "Zerto Analytics Connection does not Exist." + } + + Assert-MockCalled -CommandName Invoke-RestMethod -ModuleName ZertoApiWrapper -Exactly 1 + } + } +} + +Remove-Variable -Name function -Scope Global +Remove-Variable -Name here -Scope Global diff --git a/Tests/Public/Invoke-ZertoEvacuateVra.Tests.ps1 b/Tests/Public/Invoke-ZertoEvacuateVra.Tests.ps1 new file mode 100644 index 0000000..cfd3c2e --- /dev/null +++ b/Tests/Public/Invoke-ZertoEvacuateVra.Tests.ps1 @@ -0,0 +1,54 @@ +#Requires -Modules Pester +$global:here = (Split-Path -Parent $PSCommandPath) +$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0] + +Describe $global:function -Tag 'Unit', 'Source', 'Built' { + + Context "$global:function::Parameter Unit Tests" { + It "$global:function should have exactly 16 parameters defined" { + (Get-Command $global:function).Parameters.Count | Should -Be 16 + } + + $ParameterTestCases = @( + @{ParameterName = 'hostName'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty'; ParameterSet = @('hostName') } + @{ParameterName = 'vraName'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' ; ParameterSet = @('vraName') } + @{ParameterName = 'vraIdentifier'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' ; ParameterSet = @('vraIdentifier') } + ) + + It " parameter is of type" -TestCases $ParameterTestCases { + param($ParameterName, $Type, $Mandatory, $Validation) + Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type + } + + It " parameter has correct validation setting" -TestCases $ParameterTestCases { + param($ParameterName, $Validation) + Switch ($Validation) { + 'NotNullOrEmpty' { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1 + } + + $null { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.TypeId.Count | Should -Be 2 + } + } + } + + It " parameter is part of the correct ParameterSet(s)" -TestCases $ParameterTestCases { + param($ParameterName, $ParameterSet) + $commandParameterSets = (Get-Command $global:function).Parameters[$ParameterName].ParameterSets + foreach ($Set in $ParameterSet) { + $commandParameterSets.ContainsKey($Set) | Should -BeTrue + } + $commandParameterSets.Count | Should -Be $ParameterSet.Count + } + } + + Context "$global:function::Parameter Functional Tests" { + + } +} + +Remove-Variable -Name here -Scope Global +Remove-Variable -Name function -Scope Global diff --git a/Tests/Public/Invoke-ZertoFailover.Tests.ps1 b/Tests/Public/Invoke-ZertoFailover.Tests.ps1 index 8582291..88e38bd 100644 --- a/Tests/Public/Invoke-ZertoFailover.Tests.ps1 +++ b/Tests/Public/Invoke-ZertoFailover.Tests.ps1 @@ -1,77 +1,101 @@ #Requires -Modules Pester -$moduleFileName = "ZertoApiWrapper.psd1" -$here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper") -$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".") -$file = Get-ChildItem "$here\$sut" -$modulePath = $here -replace "Public", "" -$moduleFile = Get-ChildItem "$modulePath\$moduleFileName" -Get-Module -Name ZertoApiWrapper | Remove-Module -Force -Import-Module $moduleFile -Force - -Describe $file.BaseName -Tag 'Unit' { - - It "is valid Powershell (Has no script errors)" { - $contents = Get-Content -Path $file -ErrorAction Stop - $errors = $null - $null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors) - $errors | Should -HaveCount 0 - } +$global:here = (Split-Path -Parent $PSCommandPath) +$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0] + +Describe $global:function -Tag 'Unit', 'Source', 'Built' { + + Context "$global:function::Parameter Unit Tests" { + It "$global:function should have exactly 20 parameters defined" { + (Get-Command $global:function).Parameters.Count | Should -Be 20 + } + + $ParameterTestCases = @( + @{ParameterName = 'vpgName'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'checkpointIdentifier'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'commitPolicy'; Type = 'String'; Mandatory = $false; Validation = 'Set' } + @{ParameterName = 'shutdownPolicy'; Type = 'Int'; Mandatory = $false; Validation = 'Set' } + @{ParameterName = 'timeToWaitBeforeShutdownInSec'; Type = 'Int'; Mandatory = $false; Validation = 'Range' } + @{ParameterName = 'reverseProtection'; Type = 'bool'; Mandatory = $false; Validation = $null } + @{ParameterName = 'vmName'; Type = 'String[]'; Mandatory = $false; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'whatIf'; Type = 'Switch'; Mandatory = $false; Validation = 'ShouldProcess' } + ) - Context "$($file.BaseName)::Parameter Unit Tests" { - it "has a mandatory string parameter for the vpgName" { - Get-Command $file.BaseName | Should -HaveParameter vpgName - Get-Command $file.BaseName | Should -HaveParameter vpgName -Type string - Get-Command $file.BaseName | Should -HaveParameter vpgName -Mandatory + It " parameter is of type" -TestCases $ParameterTestCases { + param($ParameterName, $Type, $Mandatory, $Validation) + Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type } - it "has a non-mandatory string parameter for the checkpoint" { - Get-Command $file.BaseName | Should -HaveParameter checkpointIdentifier - Get-Command $file.BaseName | Should -HaveParameter checkpointIdentifier -Type string - Get-Command $file.BaseName | Should -HaveParameter checkpointIdentifier -Not -Mandatory + It " parameter has correct validation setting" -TestCases $ParameterTestCases { + param($ParameterName, $Validation) + Switch ($Validation) { + 'NotNullOrEmpty' { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1 + } + + 'Set' { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.Where{ $_ -is [ValidateSet] }.Count | Should -Be 1 + } + + 'Range' { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.Where{ $_ -is [ValidateRange] }.Count | Should -Be 1 + } + + 'ShouldProcess' { + $scriptBlock = (Get-Command $global:function).ScriptBlock + $scriptBlock | Should -match 'SupportsShouldProcess' + $scriptBlock | Should -match '\$PSCmdlet\.ShouldProcess\(.+\)' + } + + $null { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.TypeId.Count | Should -Be 2 + } + + default { + $true | Should -Be $false -Because "No Validation Selected. Review test cases" + } + } } - it "has a non-mandatory string parameter for the commit policy" { - Get-Command $file.BaseName | Should -HaveParameter commitPolicy - Get-Command $file.BaseName | Should -HaveParameter commitPolicy -Type string - Get-Command $file.BaseName | Should -HaveParameter commitPolicy -Not -Mandatory - Get-Command $file.BaseName | Should -HaveParameter commitPolicy -DefaultValue "Rollback" + It "Commit Policy Default Value is 'RollBack'" { + Get-Command $global:function | Should -HaveParameter commitPolicy -DefaultValue "Rollback" } - it "has a non-mandatory int parameter for the shutdown policy" { - Get-Command $file.BaseName | Should -HaveParameter shutdownPolicy - Get-Command $file.BaseName | Should -HaveParameter shutdownPolicy -Type int - Get-Command $file.BaseName | Should -HaveParameter shutdownPolicy -Not -Mandatory - Get-Command $file.BaseName | Should -HaveParameter shutdownPolicy -DefaultValue 0 + It "Commit Policy Only Accecpts 'RollBack', 'Commit', or 'None'" { + (Get-Command $global:function).Parameters['commitPolicy'].Attributes.Where{ $_ -is [ValidateSet] }.ValidValues | Should -HaveCount 3 + (Get-Command $global:function).Parameters['commitPolicy'].Attributes.Where{ $_ -is [ValidateSet] }.ValidValues | Should -Contain 'RollBack' + (Get-Command $global:function).Parameters['commitPolicy'].Attributes.Where{ $_ -is [ValidateSet] }.ValidValues | Should -Contain 'Commit' + (Get-Command $global:function).Parameters['commitPolicy'].Attributes.Where{ $_ -is [ValidateSet] }.ValidValues | Should -Contain 'None' } - it "has a non-mandatory int parameter for the time to wait before force shutdown" { - Get-Command $file.BaseName | Should -HaveParameter timeToWaitBeforeShutdownInSec - Get-Command $file.BaseName | Should -HaveParameter timeToWaitBeforeShutdownInSec -Type int - Get-Command $file.BaseName | Should -HaveParameter timeToWaitBeforeShutdownInSec -Not -Mandatory - Get-Command $file.BaseName | Should -HaveParameter timeToWaitBeforeShutdownInSec -DefaultValue 3600 + It "Shutdown Policy Default Value is '0'" { + Get-Command $global:function | Should -HaveParameter shutdownPolicy -DefaultValue 0 } - it "has a non-mandatory bool parameter for the reverse protection policy" { - Get-Command $file.BaseName | Should -HaveParameter reverseProtection - Get-Command $file.BaseName | Should -HaveParameter reverseProtection -Type bool - Get-Command $file.BaseName | Should -HaveParameter reverseProtection -Not -Mandatory + It "Shutdown Policy Only Accecpts 'RollBack', 'Commit', or 'None'" { + (Get-Command $global:function).Parameters['shutdownPolicy'].Attributes.Where{ $_ -is [ValidateSet] }.ValidValues | Should -HaveCount 3 + (Get-Command $global:function).Parameters['shutdownPolicy'].Attributes.Where{ $_ -is [ValidateSet] }.ValidValues | Should -Contain 0 + (Get-Command $global:function).Parameters['shutdownPolicy'].Attributes.Where{ $_ -is [ValidateSet] }.ValidValues | Should -Contain 1 + (Get-Command $global:function).Parameters['shutdownPolicy'].Attributes.Where{ $_ -is [ValidateSet] }.ValidValues | Should -Contain 2 } - it "has a non-mandatory array string parameter for the named VMs to be failed over" { - Get-Command $file.BaseName | Should -HaveParameter vmName - Get-Command $file.BaseName | Should -HaveParameter vmName -Type string[] - Get-Command $file.BaseName | Should -HaveParameter vmName -Not -Mandatory + It "Time to wait before shutdown in sec should have a default value of 3600" { + Get-Command $global:function | Should -HaveParameter timeToWaitBeforeShutdownInSec -DefaultValue 3600 } - it "Supports 'SupportsShouldProcess'" { - Get-Command $file.BaseName | Should -HaveParameter WhatIf - Get-Command $file.BaseName | Should -HaveParameter Confirm - $file | Should -FileContentMatch 'SupportsShouldProcess' - $file | Should -FileContentMatch '\$PSCmdlet\.ShouldProcess\(.+\)' + It "Time to wait before shutdown in sec should have a minimum value of 300 and max value of 86400" { + (Get-Command $global:function).Parameters['timeToWaitBeforeShutdownInSec'].Attributes.Where{ $_ -is [ValidateRange] }.MinRange | Should -Be 300 + (Get-Command $global:function).Parameters['timeToWaitBeforeShutdownInSec'].Attributes.Where{ $_ -is [ValidateRange] }.MaxRange | Should -Be 86400 } } - Context "$($file.BaseName)::Function Unit Tests" { - #TODO + Context "$global:function::Parameter Functional Tests" { + } } + +Remove-Variable -Name here -Scope Global +Remove-Variable -Name function -Scope Global diff --git a/Tests/Public/Invoke-ZertoFailoverCommit.Tests.ps1 b/Tests/Public/Invoke-ZertoFailoverCommit.Tests.ps1 index 2fa2e2e..5c59b8b 100644 --- a/Tests/Public/Invoke-ZertoFailoverCommit.Tests.ps1 +++ b/Tests/Public/Invoke-ZertoFailoverCommit.Tests.ps1 @@ -1,44 +1,56 @@ #Requires -Modules Pester -$moduleFileName = "ZertoApiWrapper.psd1" -$here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper") -$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".") -$file = Get-ChildItem "$here\$sut" -$modulePath = $here -replace "Public", "" -$moduleFile = Get-ChildItem "$modulePath\$moduleFileName" -Get-Module -Name ZertoApiWrapper | Remove-Module -Force -Import-Module $moduleFile -Force - -Describe $file.BaseName -Tag 'Unit' { - - It "is valid Powershell (Has no script errors)" { - $contents = Get-Content -Path $file -ErrorAction Stop - $errors = $null - $null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors) - $errors | Should -HaveCount 0 - } +$global:here = (Split-Path -Parent $PSCommandPath) +$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0] + +Describe $global:function -Tag 'Unit', 'Source', 'Built' { - Context "$($file.BaseName)::Parameter Unit Tests" { + Context "$global:function::Parameter Unit Tests" { - it "Supports 'ShouldProcess'" { - Get-Command $file.BaseName | Should -HaveParameter WhatIf - Get-Command $file.BaseName | Should -HaveParameter Confirm - $file | Should -FileContentMatch 'SupportsShouldProcess' - $file | Should -FileContentMatch '\$PSCmdlet\.ShouldProcess\(.+\)' + It "$global:function should have exactly 15 parameters defined" { + (Get-Command $global:function).Parameters.Count | Should -Be 15 } - it "has a mandatory string parameter for the vpgName" { - Get-Command $file.BaseName | Should -HaveParameter vpgName - Get-Command $file.BaseName | Should -HaveParameter vpgName -Type string[] - Get-Command $file.BaseName | Should -HaveParameter vpgName -Mandatory + $ParameterTestCases = @( + @{ParameterName = 'vpgName'; Type = 'String[]'; Mandatory = $true; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'reverseProtection'; Type = 'switch'; Mandatory = $false; Validation = $null } + @{ParameterName = 'whatIf'; Type = 'Switch'; Mandatory = $false; Validation = 'ShouldProcess' } + ) + + It " parameter is of type" -TestCases $ParameterTestCases { + param($ParameterName, $Type, $Mandatory, $Validation) + Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type } - it "has a switch parameter for reverse protection" { - Get-Command $file.BaseName | Should -HaveParameter reverseProtection - Get-Command $file.BaseName | Should -HaveParameter reverseProtection -Type switch + It " parameter has correct validation setting" -TestCases $ParameterTestCases { + param($ParameterName, $Validation) + Switch ($Validation) { + 'NotNullOrEmpty' { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1 + } + + 'ShouldProcess' { + $scriptBlock = (Get-Command $global:function).ScriptBlock + $scriptBlock | Should -match 'SupportsShouldProcess' + $scriptBlock | Should -match '\$PSCmdlet\.ShouldProcess\(.+\)' + } + + $null { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.TypeId.Count | Should -Be 2 + } + + default { + $true | Should -Be $false -Because "No Validation Selected. Review test cases" + } + } } } - Context "$($file.BaseName)::Function Unit Tests" { - #TODO + Context "$global:function::Parameter Functional Tests" { + } } + +Remove-Variable -Name here -Scope Global +Remove-Variable -Name function -Scope Global diff --git a/Tests/Public/Invoke-ZertoFailoverRollback.Tests.ps1 b/Tests/Public/Invoke-ZertoFailoverRollback.Tests.ps1 index 50d2f9d..248b8f1 100644 --- a/Tests/Public/Invoke-ZertoFailoverRollback.Tests.ps1 +++ b/Tests/Public/Invoke-ZertoFailoverRollback.Tests.ps1 @@ -1,19 +1,25 @@ #Requires -Modules Pester -$moduleFileName = "ZertoApiWrapper.psd1" -$here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper") -$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".") -$file = Get-ChildItem "$here\$sut" -$modulePath = $here -replace "Public", "" -$moduleFile = Get-ChildItem "$modulePath\$moduleFileName" -Get-Module -Name ZertoApiWrapper | Remove-Module -Force -Import-Module $moduleFile -Force +$global:here = (Split-Path -Parent $PSCommandPath) +$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0] -Describe $file.BaseName -Tag 'Unit' { +Describe $global:function -Tag 'Unit', 'Source', 'Built' { - It "is valid Powershell (Has no script errors)" { - $contents = Get-Content -Path $file -ErrorAction Stop - $errors = $null - $null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors) - $errors | Should -HaveCount 0 + Context "$global:function::Parameter Unit Tests" { + + It "$global:function should have exactly 12 parameters defined" { + (Get-Command $global:function).Parameters.Count | Should -Be 12 + } + + It "has a mandatory string parameter for the vpgName" { + Get-Command $global:function | Should -HaveParameter vpgName + Get-Command $global:function | Should -HaveParameter vpgName -Type string[] + Get-Command $global:function | Should -HaveParameter vpgName -Mandatory + } } -} \ No newline at end of file + Context "$global:function::Parameter Functional Tests" { + + } +} + +Remove-Variable -Name here -Scope Global +Remove-Variable -Name function -Scope Global diff --git a/Tests/Public/Invoke-ZertoForceSync.Tests.ps1 b/Tests/Public/Invoke-ZertoForceSync.Tests.ps1 index 50d2f9d..e35259a 100644 --- a/Tests/Public/Invoke-ZertoForceSync.Tests.ps1 +++ b/Tests/Public/Invoke-ZertoForceSync.Tests.ps1 @@ -1,19 +1,26 @@ #Requires -Modules Pester -$moduleFileName = "ZertoApiWrapper.psd1" -$here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper") -$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".") -$file = Get-ChildItem "$here\$sut" -$modulePath = $here -replace "Public", "" -$moduleFile = Get-ChildItem "$modulePath\$moduleFileName" -Get-Module -Name ZertoApiWrapper | Remove-Module -Force -Import-Module $moduleFile -Force +$global:here = (Split-Path -Parent $PSCommandPath) +$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0] -Describe $file.BaseName -Tag 'Unit' { +Describe $global:function -Tag 'Unit', 'Source', 'Built' { + + Context "$global:function::Parameter Unit Tests" { + + It "$global:function should have exactly 12 parameters defined" { + (Get-Command $global:function).Parameters.Count | Should -Be 12 + } + + It "has a mandatory string parameter for the vpgName" { + Get-Command $global:function | Should -HaveParameter vpgName + Get-Command $global:function | Should -HaveParameter vpgName -Type string[] + Get-Command $global:function | Should -HaveParameter vpgName -Mandatory + } + } + + Context "$global:function::Parameter Functional Tests" { - It "is valid Powershell (Has no script errors)" { - $contents = Get-Content -Path $file -ErrorAction Stop - $errors = $null - $null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors) - $errors | Should -HaveCount 0 } -} \ No newline at end of file +} + +Remove-Variable -Name here -Scope Global +Remove-Variable -Name function -Scope Global diff --git a/Tests/Public/Invoke-ZertoMove.Tests.ps1 b/Tests/Public/Invoke-ZertoMove.Tests.ps1 index 50d2f9d..efb1260 100644 --- a/Tests/Public/Invoke-ZertoMove.Tests.ps1 +++ b/Tests/Public/Invoke-ZertoMove.Tests.ps1 @@ -1,19 +1,83 @@ #Requires -Modules Pester -$moduleFileName = "ZertoApiWrapper.psd1" -$here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper") -$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".") -$file = Get-ChildItem "$here\$sut" -$modulePath = $here -replace "Public", "" -$moduleFile = Get-ChildItem "$modulePath\$moduleFileName" -Get-Module -Name ZertoApiWrapper | Remove-Module -Force -Import-Module $moduleFile -Force - -Describe $file.BaseName -Tag 'Unit' { - - It "is valid Powershell (Has no script errors)" { - $contents = Get-Content -Path $file -ErrorAction Stop - $errors = $null - $null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors) - $errors | Should -HaveCount 0 +$global:here = (Split-Path -Parent $PSCommandPath) +$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0] + +Describe $global:function -Tag 'Unit', 'Source', 'Built' { + + Context "$global:function::Parameter Unit Tests" { + It "$global:function should have exactly 21 parameters defined" { + (Get-Command $global:function).Parameters.Count | Should -Be 21 + } + + $ParameterTestCases = @( + @{ParameterName = 'vpgIdentifier'; Type = 'Guid[]'; Mandatory = $true; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'vpgName'; Type = 'String[]'; Mandatory = $true; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'commitPolicy'; Type = 'String'; Mandatory = $false; Validation = 'Set' } + @{ParameterName = 'commitPolicyTimeout'; Type = 'Int'; Mandatory = $false; Validation = 'Range' } + @{ParameterName = 'forceShutdown'; Type = 'Switch'; Mandatory = $false; Validation = $null } + @{ParameterName = 'disableReverseProtection'; Type = 'Switch'; Mandatory = $false; Validation = $null } + @{ParameterName = 'keepSourceVms'; Type = 'Switch'; Mandatory = $false; Validation = $null } + @{ParameterName = 'ContinueOnPreScriptFailure'; Type = 'Switch'; Mandatory = $false; Validation = $null } + @{ParameterName = 'whatIf'; Type = 'Switch'; Mandatory = $false; Validation = 'ShouldProcess' } + ) + + It " parameter is of type" -TestCases $ParameterTestCases { + param($ParameterName, $Type, $Mandatory, $Validation) + Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type + } + + It " parameter has correct validation setting" -TestCases $ParameterTestCases { + param($ParameterName, $Validation) + Switch ($Validation) { + 'NotNullOrEmpty' { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1 + } + + 'Set' { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.Where{ $_ -is [ValidateSet] }.Count | Should -Be 1 + } + + 'Range' { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.Where{ $_ -is [ValidateRange] }.Count | Should -Be 1 + } + + 'ShouldProcess' { + $scriptBlock = (Get-Command $global:function).ScriptBlock + $scriptBlock | Should -match 'SupportsShouldProcess' + $scriptBlock | Should -match '\$PSCmdlet\.ShouldProcess\(.+\)' + } + + $null { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.TypeId.Count | Should -Be 2 + } + + default { + $true | Should -Be $false -Because "No Validation Selected. Review test cases" + } + } + } + + It "Commit Policy Only Accecpts 'RollBack', 'Commit', or 'None'" { + (Get-Command $global:function).Parameters['commitPolicy'].Attributes.Where{ $_ -is [ValidateSet] }.ValidValues | Should -HaveCount 3 + (Get-Command $global:function).Parameters['commitPolicy'].Attributes.Where{ $_ -is [ValidateSet] }.ValidValues | Should -Contain 'RollBack' + (Get-Command $global:function).Parameters['commitPolicy'].Attributes.Where{ $_ -is [ValidateSet] }.ValidValues | Should -Contain 'Commit' + (Get-Command $global:function).Parameters['commitPolicy'].Attributes.Where{ $_ -is [ValidateSet] }.ValidValues | Should -Contain 'None' + } + + It "Commit Policy Timeout should have a minimum value of 300 and max value of 86400" { + (Get-Command $global:function).Parameters['commitPolicyTimeout'].Attributes.Where{ $_ -is [ValidateRange] }.MinRange | Should -Be 300 + (Get-Command $global:function).Parameters['commitPolicyTimeout'].Attributes.Where{ $_ -is [ValidateRange] }.MaxRange | Should -Be 86400 + } } -} \ No newline at end of file + + Context "$global:function::Parameter Functional Tests" { + + } +} + +Remove-Variable -Name here -Scope Global +Remove-Variable -Name function -Scope Global diff --git a/Tests/Public/Invoke-ZertoMoveCommit.Tests.ps1 b/Tests/Public/Invoke-ZertoMoveCommit.Tests.ps1 index 50d2f9d..06b7449 100644 --- a/Tests/Public/Invoke-ZertoMoveCommit.Tests.ps1 +++ b/Tests/Public/Invoke-ZertoMoveCommit.Tests.ps1 @@ -1,19 +1,56 @@ #Requires -Modules Pester -$moduleFileName = "ZertoApiWrapper.psd1" -$here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper") -$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".") -$file = Get-ChildItem "$here\$sut" -$modulePath = $here -replace "Public", "" -$moduleFile = Get-ChildItem "$modulePath\$moduleFileName" -Get-Module -Name ZertoApiWrapper | Remove-Module -Force -Import-Module $moduleFile -Force - -Describe $file.BaseName -Tag 'Unit' { - - It "is valid Powershell (Has no script errors)" { - $contents = Get-Content -Path $file -ErrorAction Stop - $errors = $null - $null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors) - $errors | Should -HaveCount 0 +$global:here = (Split-Path -Parent $PSCommandPath) +$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0] + +Describe $global:function -Tag 'Unit', 'Source', 'Built' { + + Context "$global:function::Parameter Unit Tests" { + + It "$global:function should have exactly 16 parameters defined" { + (Get-Command $global:function).Parameters.Count | Should -Be 16 + } + + $ParameterTestCases = @( + @{ParameterName = 'vpgName'; Type = 'String[]'; Mandatory = $true; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'reverseProtection'; Type = 'switch'; Mandatory = $false; Validation = $null } + @{ParameterName = 'whatIf'; Type = 'Switch'; Mandatory = $false; Validation = 'ShouldProcess' } + ) + + It " parameter is of type" -TestCases $ParameterTestCases { + param($ParameterName, $Type, $Mandatory, $Validation) + Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type + } + + It " parameter has correct validation setting" -TestCases $ParameterTestCases { + param($ParameterName, $Validation) + Switch ($Validation) { + 'NotNullOrEmpty' { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1 + } + + 'ShouldProcess' { + $scriptBlock = (Get-Command $global:function).ScriptBlock + $scriptBlock | Should -match 'SupportsShouldProcess' + $scriptBlock | Should -match '\$PSCmdlet\.ShouldProcess\(.+\)' + } + + $null { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.TypeId.Count | Should -Be 2 + } + + default { + $true | Should -Be $false -Because "No Validation Selected. Review test cases" + } + } + } + } + + Context "$global:function::Parameter Functional Tests" { + } -} \ No newline at end of file +} + +Remove-Variable -Name here -Scope Global +Remove-Variable -Name function -Scope Global diff --git a/Tests/Public/Invoke-ZertoMoveRollback.Tests.ps1 b/Tests/Public/Invoke-ZertoMoveRollback.Tests.ps1 index 50d2f9d..8e0b4fd 100644 --- a/Tests/Public/Invoke-ZertoMoveRollback.Tests.ps1 +++ b/Tests/Public/Invoke-ZertoMoveRollback.Tests.ps1 @@ -1,19 +1,25 @@ #Requires -Modules Pester -$moduleFileName = "ZertoApiWrapper.psd1" -$here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper") -$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".") -$file = Get-ChildItem "$here\$sut" -$modulePath = $here -replace "Public", "" -$moduleFile = Get-ChildItem "$modulePath\$moduleFileName" -Get-Module -Name ZertoApiWrapper | Remove-Module -Force -Import-Module $moduleFile -Force +$global:here = (Split-Path -Parent $PSCommandPath) +$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0] -Describe $file.BaseName -Tag 'Unit' { +Describe $global:function -Tag 'Unit', 'Source', 'Built' { - It "is valid Powershell (Has no script errors)" { - $contents = Get-Content -Path $file -ErrorAction Stop - $errors = $null - $null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors) - $errors | Should -HaveCount 0 + Context "$global:function::Parameter Unit Tests" { + + It "$global:function should have exactly 14 parameters defined" { + (Get-Command $global:function).Parameters.Count | Should -Be 14 + } + + It "has a mandatory string parameter for the vpgName" { + Get-Command $global:function | Should -HaveParameter vpgName + Get-Command $global:function | Should -HaveParameter vpgName -Type string[] + Get-Command $global:function | Should -HaveParameter vpgName -Mandatory + } } -} \ No newline at end of file + Context "$global:function::Parameter Functional Tests" { + + } +} + +Remove-Variable -Name here -Scope Global +Remove-Variable -Name function -Scope Global diff --git a/Tests/Public/Invoke-ZertoRestRequest.Tests.ps1 b/Tests/Public/Invoke-ZertoRestRequest.Tests.ps1 new file mode 100644 index 0000000..16ed79e --- /dev/null +++ b/Tests/Public/Invoke-ZertoRestRequest.Tests.ps1 @@ -0,0 +1,89 @@ +#Requires -Modules Pester +$global:here = (Split-Path -Parent $PSCommandPath) +$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0] + +Describe $global:function -Tag 'Unit', 'Source', 'Built' { + + InModuleScope -ModuleName ZertoApiWrapper { + Mock -ModuleName ZertoApiWrapper -CommandName Invoke-RestMethod { + "Ran Command" + } + + Context "$global:function::Parameter Unit Tests" { + $thisCommand = Get-Command Invoke-ZertoRestRequest + $ParameterNameTestCases = @( + @{ParameterName = "uri"; Type = "String"; Mandatory = $true; DefaultValue = $null; TestName = "URI" } + @{ParameterName = "method"; Type = "String"; Mandatory = $false; DefaultValue = 'GET'; TestName = "Method" } + @{ParameterName = "body"; Type = "String"; Mandatory = $false; DefaultValue = $null; TestName = "Body" } + @{ParameterName = "credential"; Type = "PSCredential"; Mandatory = $false; DefaultValue = $null; TestName = "Credential" } + @{ParameterName = "returnHeaders"; Type = "Switch"; Mandatory = $false; DefaultValue = $null; TestName = "Return Headers" } + ) + + It " parameter has the right Type, Default Value, and Mandatory Setting" -TestCases $ParameterNameTestCases { + param($ParameterName, $Type, $DefaultValue, $Mandatory) + if ($Mandatory) { + $thisCommand | Should -HaveParameter $ParameterName -Type $Type -Mandatory + } else { + $thisCommand | Should -HaveParameter $ParameterName -Type $Type + $thisCommand | Should -HaveParameter $ParameterName -Not -Mandatory + } + if ($null -ne $DefaultValue) { + $thisCommand | Should -HaveParameter $ParameterName -DefaultValue $DefaultValue + } + } + + $ParameterValidationTestCases = @( + @{ParameterName = "URI"; TestName = "URI" } + @{ParameterName = "body"; TestName = "Body" } + ) + + It " parameter cannot be null or empty" -TestCases $ParameterValidationTestCases { + param($ParameterName) + $thisParameter = $thisCommand.Parameters[$ParameterName] + $thisParameter.Attributes.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1 + } + + It "Method parameter can only be 'GET', 'POST', 'PUT', 'DELETE'" { + $thisParameter = $thisCommand.Parameters['method'] + $thisParameter.Attributes.Where{ $_ -is [ValidateSet] }.Count | Should -Be 1 + $thisParameter.Attributes.Where{ $_ -is [ValidateSet] }.validValues -contains 'GET' | Should -BeTrue + $thisParameter.Attributes.Where{ $_ -is [ValidateSet] }.validValues -contains 'PUT' | Should -BeTrue + $thisParameter.Attributes.Where{ $_ -is [ValidateSet] }.validValues -contains 'POST' | Should -BeTrue + $thisParameter.Attributes.Where{ $_ -is [ValidateSet] }.validValues -contains 'DELETE' | Should -BeTrue + $thisParameter.Attributes.Where{ $_ -is [ValidateSet] }.validValues.Count | Should -Be 4 + } + } + + Context "$global:function::Function Unit Tests" { + Mock -ModuleName ZertoApiWrapper -CommandName Invoke-RestMethod { + "Ran Command" + } + + BeforeEach { + Set-Variable -Name zvmHeaders -Scope Script -Value (@{ "Accept" = "application/json" }) + Set-Variable -Name zvmLastAction -Scope Script -Value $(Get-Date).Ticks + Set-Variable -Name zvmServer -Scope Script -Value "192.168.1.100" + Set-Variable -Name zvmPort -Scope Script -Value 9669 + } + + It "runs when called" { + Invoke-ZertoRestRequest -uri "MyUri" | Should -Be "Ran Command" + } + + It "throws an error when zvmLastAction was more than 30 minutes ago" { + Set-Variable -Name zvmLastAction -Scope Script -Value $(Get-Date).AddMinutes(-31).Ticks + { Invoke-ZertoRestRequest -uri "MyUri" } | Should Throw "Authorization Token has Expired" + } + + It "throws an error when the zvmServer variable does not exist" { + Remove-Variable -Name zvmServer -Scope Script + { Invoke-ZertoRestRequest -uri "MyUri" } | Should Throw "Zerto Connection does not Exist." + } + + Assert-MockCalled -CommandName Invoke-RestMethod -ModuleName ZertoApiWrapper -Exactly 1 + } + } +} + +Remove-Variable -Name function -Scope Global +Remove-Variable -Name here -Scope Global diff --git a/Tests/Public/Mocks/AuthHeaders.json b/Tests/Public/Mocks/AuthHeaders.json new file mode 100644 index 0000000..6f904f8 --- /dev/null +++ b/Tests/Public/Mocks/AuthHeaders.json @@ -0,0 +1,23 @@ +{ + "apiRequestResults": "", + "Headers": { + "Cache-Control": [ + "no-cache" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "x-zerto-session": [ + "e34da0b0-4bc2-4cda-b316-0384e35bdca5" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Thu, 11 Jul 2019 19:05:40 GMT" + ], + "Content-Length": [ + "0" + ] + } +} diff --git a/Tests/Public/Mocks/CopyVpgSettings.json b/Tests/Public/Mocks/CopyVpgSettings.json new file mode 100644 index 0000000..07f85c3 --- /dev/null +++ b/Tests/Public/Mocks/CopyVpgSettings.json @@ -0,0 +1,79 @@ +{ + "Basic": { + "JournalHistoryInHours": 24, + "Name": "Test-SQL_Copy_1", + "Priority": "Medium", + "ProtectedSiteIdentifier": "15aa0d43-69cd-400a-8b99-fe94bbac3e19", + "RecoverySiteIdentifier": "8e1c9f53-4973-4a4a-b2dd-1ebb293614d8", + "RpoInSeconds": 300, + "ServiceProfileIdentifier": null, + "TestIntervalInMinutes": 262080, + "UseWanCompression": true, + "ZorgIdentifier": null + }, + "BootGroups": { + "BootGroups": [ + "@{BootDelayInSeconds=0; BootGroupIdentifier=00000000-0000-0000-0000-000000000000; Name=Default}" + ] + }, + "Journal": { + "DatastoreIdentifier": null, + "Limitation": { + "HardLimitInMB": 153600, + "HardLimitInPercent": 0, + "WarningThresholdInMB": 115200, + "WarningThresholdInPercent": 0 + } + }, + "LongTermRetention": null, + "Networks": { + "Failover": { + "Hypervisor": "@{DefaultNetworkIdentifier=09db6c5b-b956-430f-9589-b58876ca377a.network-20}", + "PublicCloud": null, + "VCD": null + }, + "FailoverTest": { + "Hypervisor": "@{DefaultNetworkIdentifier=09db6c5b-b956-430f-9589-b58876ca377a.network-20}", + "PublicCloud": null, + "VCD": null + } + }, + "Protected": { + "VCD": null + }, + "Recovery": { + "DefaultDatastoreClusterIdentifier": "09db6c5b-b956-430f-9589-b58876ca377a.group-p44", + "DefaultDatastoreIdentifier": null, + "DefaultFolderIdentifier": "09db6c5b-b956-430f-9589-b58876ca377a.group-v3", + "DefaultHostClusterIdentifier": "09db6c5b-b956-430f-9589-b58876ca377a.domain-c7", + "DefaultHostIdentifier": null, + "PublicCloud": null, + "ResourcePoolIdentifier": null, + "VCD": null + }, + "Scripting": { + "PostBackup": null, + "PostRecovery": { + "Command": null, + "Parameters": null, + "TimeoutInSeconds": 300 + }, + "PreRecovery": { + "Command": null, + "Parameters": null, + "TimeoutInSeconds": 300 + } + }, + "Vms": [ + { + "BootGroupIdentifier": "00000000-0000-0000-0000-000000000000", + "Journal": "@{DatastoreIdentifier=; Limitation=}", + "Nics": "", + "Recovery": "@{DatastoreClusterIdentifier=09db6c5b-b956-430f-9589-b58876ca377a.group-p44; DatastoreIdentifier=; FolderIdentifier=09db6c5b-b956-430f-9589-b58876ca377a.group-v3; HostClusterIdentifier=09db6c5b-b956-430f-9589-b58876ca377a.domain-c7; HostIdentifier=; PublicCloud=; ResourcePoolIdentifier=; VCD=}", + "VmIdentifier": "d809de8e-deb7-45cc-b620-08030a1143e1.vm-87", + "Volumes": "" + } + ], + "VpgIdentifier": null, + "VpgSettingsIdentifier": "0be951ef-229a-401c-9e0d-bd8a5baea19a" +} diff --git a/Tests/Public/Mocks/GetDhcpVra.json b/Tests/Public/Mocks/GetDhcpVra.json new file mode 100644 index 0000000..0c2539c --- /dev/null +++ b/Tests/Public/Mocks/GetDhcpVra.json @@ -0,0 +1,50 @@ +{ + "DatastoreClusterIdentifier": null, + "DatastoreClusterName": null, + "DatastoreIdentifier": "d4a6a1d5-79e9-4308-990a-7c3e616f0908.datastore-21", + "DatastoreName": "datastore1 (2)", + "HostIdentifier": "d4a6a1d5-79e9-4308-990a-7c3e616f0908.host-18", + "HostVersion": "6.7", + "IpAddress": "192.168.10.110", + "Link": { + "href": "https://192.168.10.20:9669/v1/vras/5377857665828094938", + "identifier": "5377857665828094938", + "rel": null, + "type": "VraApi" + }, + "Link_{0}": { + "href": "https://192.168.10.20:9669/v1/vras/5377857665828094938", + "rel": "self", + "type": "VraApi" + }, + "MemoryInGB": 1, + "NetworkIdentifier": "d4a6a1d5-79e9-4308-990a-7c3e616f0908.network-22", + "NetworkName": "VM Network", + "Progress": 0, + "ProtectedCounters": { + "Vms": 0, + "Volumes": 0, + "Vpgs": 0 + }, + "RecoveryCounters": { + "Vms": 0, + "Volumes": 0, + "Vpgs": 0 + }, + "SelfProtectedVpgs": 0, + "Status": 0, + "VraAlerts": { + "VraAlertsStatus": 0 + }, + "VraGroup": "default_group", + "VraIdentifier": 5377857665828094938, + "VraIdentifierStr": "5377857665828094938", + "VraName": "Z-VRA-ncesx1.nc.lab", + "VraNetworkDataApi": { + "DefaultGateway": "", + "SubnetMask": "255.255.255.0", + "VraIPAddress": "192.168.10.110", + "VraIPConfigurationTypeApi": "Dhcp" + }, + "VraVersion": "7.0" +} diff --git a/Tests/Public/Mocks/GetSingleVra.json b/Tests/Public/Mocks/GetSingleVra.json new file mode 100644 index 0000000..df9776c --- /dev/null +++ b/Tests/Public/Mocks/GetSingleVra.json @@ -0,0 +1,50 @@ +{ + "DatastoreClusterIdentifier": null, + "DatastoreClusterName": null, + "DatastoreIdentifier": "d4a6a1d5-79e9-4308-990a-7c3e616f0908.datastore-19", + "DatastoreName": "datastore1", + "HostIdentifier": "d4a6a1d5-79e9-4308-990a-7c3e616f0908.host-15", + "HostVersion": "6.7", + "IpAddress": "192.168.10.15", + "Link": { + "href": "https://192.168.10.20:9669/v1/vras/5377857665828093654", + "identifier": "5377857665828093654", + "rel": null, + "type": "VraApi" + }, + "Link_{0}": { + "href": "https://192.168.10.20:9669/v1/vras/5377857665828093654", + "rel": "self", + "type": "VraApi" + }, + "MemoryInGB": 1, + "NetworkIdentifier": "d4a6a1d5-79e9-4308-990a-7c3e616f0908.network-22", + "NetworkName": "VM Network", + "Progress": 0, + "ProtectedCounters": { + "Vms": 0, + "Volumes": 0, + "Vpgs": 0 + }, + "RecoveryCounters": { + "Vms": 0, + "Volumes": 0, + "Vpgs": 0 + }, + "SelfProtectedVpgs": 0, + "Status": 0, + "VraAlerts": { + "VraAlertsStatus": 0 + }, + "VraGroup": "default_group", + "VraIdentifier": 5377857665828093654, + "VraIdentifierStr": "5377857665828093654", + "VraName": "Z-VRA-ncesx2.nc.lab", + "VraNetworkDataApi": { + "DefaultGateway": "192.168.10.254", + "SubnetMask": "255.255.255.0", + "VraIPAddress": "192.168.10.15", + "VraIPConfigurationTypeApi": "Static" + }, + "VraVersion": "7.0" +} diff --git a/Tests/Public/Mocks/GetVpg.json b/Tests/Public/Mocks/GetVpg.json new file mode 100644 index 0000000..f1766dc --- /dev/null +++ b/Tests/Public/Mocks/GetVpg.json @@ -0,0 +1,75 @@ +{ + "ActiveProcessesApi": { + "RunningFailOverTestApi": null + }, + "ActualRPO": 7, + "BackupEnabled": false, + "ConfiguredRpoSeconds": 300, + "Entities": { + "Protected": 0, + "Recovery": 0, + "Source": 0, + "Target": 0 + }, + "FailSafeHistory": { + "ActualFailSafeHistory": 60, + "ConfiguredFailSafeHistory": 240, + "FailSafeDescription": "" + }, + "HistoryStatusApi": { + "ActualHistoryInMinutes": 92, + "ConfiguredHistoryInMinutes": 1440, + "EarliestCheckpoint": { + "CheckpointIdentifier": "786", + "Tag": null, + "TimeStamp": "2019-07-20T19:30:19Z" + } + }, + "IOPs": 13, + "LastTest": null, + "Link": { + "href": "https://192.168.10.20:9669/v1/vpgs/57f502ff-3c41-4aff-b20a-6638205b73cd", + "identifier": "57f502ff-3c41-4aff-b20a-6638205b73cd", + "rel": null, + "type": "VpgApi" + }, + "Link_{0}": { + "href": "https://192.168.10.20:9669/v1/vpgs/57f502ff-3c41-4aff-b20a-6638205b73cd", + "rel": "self", + "type": "VpgApi" + }, + "OrganizationName": "", + "Priority": 1, + "ProgressPercentage": 0, + "ProtectedSite": { + "href": "https://192.168.10.20:9669/v1/localsite", + "identifier": "9e09efa0-0d00-46ed-929b-f86273b28205", + "rel": null, + "type": "LocalSiteApi" + }, + "ProvisionedStorageInMB": 336118, + "RecoverySite": { + "href": "https://192.168.10.20:9669/v1/peersites/057cab27-f02a-443a-989d-7f14341fa9c3", + "identifier": "057cab27-f02a-443a-989d-7f14341fa9c3", + "rel": null, + "type": "PeerSiteApi" + }, + "ServiceProfile": null, + "ServiceProfileIdentifier": null, + "ServiceProfileName": "", + "SourceSite": "WCHL - NC", + "Status": 1, + "SubStatus": 0, + "TargetSite": "WCHL - CA", + "ThroughputInMB": 0.27197265625, + "UsedStorageInMB": 245465, + "VmsCount": 4, + "VpgIdentifier": "57f502ff-3c41-4aff-b20a-6638205b73cd", + "VpgName": "ExportStuff", + "Zorg": { + "href": "https://192.168.10.20:9669/v1/zorgs/00000000-0000-0000-0000-000000000000", + "identifier": "00000000-0000-0000-0000-000000000000", + "rel": null, + "type": "ZorgApi" + } +} diff --git a/Tests/Public/Mocks/LocalSiteInfo.json b/Tests/Public/Mocks/LocalSiteInfo.json new file mode 100644 index 0000000..8fe97a2 --- /dev/null +++ b/Tests/Public/Mocks/LocalSiteInfo.json @@ -0,0 +1,20 @@ +{ + "BandwidthThrottlingInMBs": -1, + "ContactEmail": "vSphere-Site01@zerto.com", + "ContactName": "vSphere-Site01@zerto.com", + "ContactPhone": "066-6666666", + "IpAddress": "192.168.200.1", + "IsReplicationToSelfEnabled": true, + "Link": { + "href": "https://192.168.222.1:7669/v1/localsite", + "identifier": "63a62dc2-ef6f-45aa-809f-9dbaeb8c06cf", + "rel": null, + "type": "LocalSiteApi" + }, + "Location": "vSphere-Site01", + "SiteIdentifier": "63a62dc2-ef6f-45aa-809f-9dbaeb8c06cf", + "SiteName": "vSphere-Site01 at Zerto", + "SiteType": "VCenter", + "UtcOffsetInMinutes": -240, + "Version": "7.0.0" +} diff --git a/Tests/Public/Mocks/PairingToken.json b/Tests/Public/Mocks/PairingToken.json new file mode 100644 index 0000000..1b34001 --- /dev/null +++ b/Tests/Public/Mocks/PairingToken.json @@ -0,0 +1,4 @@ +{ + "Token": "TH15ISN0T4R3AL70KEN", + "UtcExpirationDate": "10/09/2019 12:55 PM" +} diff --git a/Tests/Public/Mocks/ProtectedVms.json b/Tests/Public/Mocks/ProtectedVms.json new file mode 100644 index 0000000..8326055 --- /dev/null +++ b/Tests/Public/Mocks/ProtectedVms.json @@ -0,0 +1,274 @@ +[ + { + "ActualRPO": 7, + "EnabledActions": { + "IsFlrEnabled": true + }, + "Entities": { + "Protected": 0, + "Recovery": 0, + "Source": 0, + "Target": 0 + }, + "HardwareVersion": "vmx-15", + "IOPs": 2, + "IsVmExists": true, + "JournalHardLimit": { + "LimitType": 1, + "LimitValue": 153600 + }, + "JournalUsedStorageMb": 640, + "JournalWarningThreshold": { + "LimitType": 1, + "LimitValue": 115200 + }, + "LastTest": null, + "Link": { + "href": "https://192.168.10.20:9669/v1/vms/d4a6a1d5-79e9-4308-990a-7c3e616f0908.vm-38?VpgIdentifier=57f502ff-3c41-4aff-b20a-6638205b73cd", + "identifier": "d4a6a1d5-79e9-4308-990a-7c3e616f0908.vm-38?VpgIdentifier=57f502ff-3c41-4aff-b20a-6638205b73cd", + "rel": null, + "type": "VmApi" + }, + "Link_{0}": { + "href": "https://192.168.10.20:9669/v1/vms/d4a6a1d5-79e9-4308-990a-7c3e616f0908.vm-38?VpgIdentifier=57f502ff-3c41-4aff-b20a-6638205b73cd", + "rel": "self", + "type": "VmApi" + }, + "OrganizationName": "", + "OutgoingBandWidthInMbps": 0.001953125, + "Priority": 1, + "ProtectedSite": { + "href": "https://192.168.10.20:9669/v1/localsite", + "identifier": "9e09efa0-0d00-46ed-929b-f86273b28205", + "rel": null, + "type": "LocalSiteApi" + }, + "ProvisionedStorageInMB": 77906, + "RecoveryHostIdentifier": "f45d81e4-4ff5-4376-a5c8-20ffe8d52431.host-15", + "RecoverySite": { + "href": "https://192.168.10.20:9669/v1/peersites/057cab27-f02a-443a-989d-7f14341fa9c3", + "identifier": "057cab27-f02a-443a-989d-7f14341fa9c3", + "rel": null, + "type": "PeerSiteApi" + }, + "SourceSite": "WCHL - NC", + "Status": 1, + "SubStatus": 0, + "TargetSite": "WCHL - CA", + "ThroughputInMB": 0, + "UsedStorageInMB": 77906, + "VmIdentifier": "d4a6a1d5-79e9-4308-990a-7c3e616f0908.vm-38", + "VmName": "ncesx3.nc.lab", + "Volumes": [ + { + "VmVolumeIdentifier": "scsi:0:0" + } + ], + "VpgIdentifier": "57f502ff-3c41-4aff-b20a-6638205b73cd", + "VpgName": "ExportStuff" + }, + { + "ActualRPO": 7, + "EnabledActions": { + "IsFlrEnabled": true + }, + "Entities": { + "Protected": 0, + "Recovery": 0, + "Source": 0, + "Target": 0 + }, + "HardwareVersion": "vmx-15", + "IOPs": 1, + "IsVmExists": true, + "JournalHardLimit": { + "LimitType": 1, + "LimitValue": 153600 + }, + "JournalUsedStorageMb": 609, + "JournalWarningThreshold": { + "LimitType": 1, + "LimitValue": 115200 + }, + "LastTest": null, + "Link": { + "href": "https://192.168.10.20:9669/v1/vms/d4a6a1d5-79e9-4308-990a-7c3e616f0908.vm-37?VpgIdentifier=57f502ff-3c41-4aff-b20a-6638205b73cd", + "identifier": "d4a6a1d5-79e9-4308-990a-7c3e616f0908.vm-37?VpgIdentifier=57f502ff-3c41-4aff-b20a-6638205b73cd", + "rel": null, + "type": "VmApi" + }, + "Link_{0}": { + "href": "https://192.168.10.20:9669/v1/vms/d4a6a1d5-79e9-4308-990a-7c3e616f0908.vm-37?VpgIdentifier=57f502ff-3c41-4aff-b20a-6638205b73cd", + "rel": "self", + "type": "VmApi" + }, + "OrganizationName": "", + "OutgoingBandWidthInMbps": 0.0009765625, + "Priority": 1, + "ProtectedSite": { + "href": "https://192.168.10.20:9669/v1/localsite", + "identifier": "9e09efa0-0d00-46ed-929b-f86273b28205", + "rel": null, + "type": "LocalSiteApi" + }, + "ProvisionedStorageInMB": 77906, + "RecoveryHostIdentifier": "f45d81e4-4ff5-4376-a5c8-20ffe8d52431.host-15", + "RecoverySite": { + "href": "https://192.168.10.20:9669/v1/peersites/057cab27-f02a-443a-989d-7f14341fa9c3", + "identifier": "057cab27-f02a-443a-989d-7f14341fa9c3", + "rel": null, + "type": "PeerSiteApi" + }, + "SourceSite": "WCHL - NC", + "Status": 1, + "SubStatus": 0, + "TargetSite": "WCHL - CA", + "ThroughputInMB": 0, + "UsedStorageInMB": 77906, + "VmIdentifier": "d4a6a1d5-79e9-4308-990a-7c3e616f0908.vm-37", + "VmName": "ncesx2.nc.lab", + "Volumes": [ + { + "VmVolumeIdentifier": "scsi:0:0" + } + ], + "VpgIdentifier": "57f502ff-3c41-4aff-b20a-6638205b73cd", + "VpgName": "ExportStuff" + }, + { + "ActualRPO": 7, + "EnabledActions": { + "IsFlrEnabled": true + }, + "Entities": { + "Protected": 0, + "Recovery": 0, + "Source": 0, + "Target": 0 + }, + "HardwareVersion": "vmx-15", + "IOPs": 2, + "IsVmExists": true, + "JournalHardLimit": { + "LimitType": 1, + "LimitValue": 153600 + }, + "JournalUsedStorageMb": 634, + "JournalWarningThreshold": { + "LimitType": 1, + "LimitValue": 115200 + }, + "LastTest": null, + "Link": { + "href": "https://192.168.10.20:9669/v1/vms/d4a6a1d5-79e9-4308-990a-7c3e616f0908.vm-36?VpgIdentifier=57f502ff-3c41-4aff-b20a-6638205b73cd", + "identifier": "d4a6a1d5-79e9-4308-990a-7c3e616f0908.vm-36?VpgIdentifier=57f502ff-3c41-4aff-b20a-6638205b73cd", + "rel": null, + "type": "VmApi" + }, + "Link_{0}": { + "href": "https://192.168.10.20:9669/v1/vms/d4a6a1d5-79e9-4308-990a-7c3e616f0908.vm-36?VpgIdentifier=57f502ff-3c41-4aff-b20a-6638205b73cd", + "rel": "self", + "type": "VmApi" + }, + "OrganizationName": "", + "OutgoingBandWidthInMbps": 0.00146484375, + "Priority": 1, + "ProtectedSite": { + "href": "https://192.168.10.20:9669/v1/localsite", + "identifier": "9e09efa0-0d00-46ed-929b-f86273b28205", + "rel": null, + "type": "LocalSiteApi" + }, + "ProvisionedStorageInMB": 77906, + "RecoveryHostIdentifier": "f45d81e4-4ff5-4376-a5c8-20ffe8d52431.host-15", + "RecoverySite": { + "href": "https://192.168.10.20:9669/v1/peersites/057cab27-f02a-443a-989d-7f14341fa9c3", + "identifier": "057cab27-f02a-443a-989d-7f14341fa9c3", + "rel": null, + "type": "PeerSiteApi" + }, + "SourceSite": "WCHL - NC", + "Status": 1, + "SubStatus": 0, + "TargetSite": "WCHL - CA", + "ThroughputInMB": 0, + "UsedStorageInMB": 77906, + "VmIdentifier": "d4a6a1d5-79e9-4308-990a-7c3e616f0908.vm-36", + "VmName": "ncesx1.nc.lab", + "Volumes": [ + { + "VmVolumeIdentifier": "scsi:0:0" + } + ], + "VpgIdentifier": "57f502ff-3c41-4aff-b20a-6638205b73cd", + "VpgName": "ExportStuff" + }, + { + "ActualRPO": 7, + "EnabledActions": { + "IsFlrEnabled": true + }, + "Entities": { + "Protected": 0, + "Recovery": 0, + "Source": 0, + "Target": 0 + }, + "HardwareVersion": "vmx-14", + "IOPs": 5, + "IsVmExists": true, + "JournalHardLimit": { + "LimitType": 1, + "LimitValue": 153600 + }, + "JournalUsedStorageMb": 642, + "JournalWarningThreshold": { + "LimitType": 1, + "LimitValue": 115200 + }, + "LastTest": null, + "Link": { + "href": "https://192.168.10.20:9669/v1/vms/d4a6a1d5-79e9-4308-990a-7c3e616f0908.vm-26?VpgIdentifier=57f502ff-3c41-4aff-b20a-6638205b73cd", + "identifier": "d4a6a1d5-79e9-4308-990a-7c3e616f0908.vm-26?VpgIdentifier=57f502ff-3c41-4aff-b20a-6638205b73cd", + "rel": null, + "type": "VmApi" + }, + "Link_{0}": { + "href": "https://192.168.10.20:9669/v1/vms/d4a6a1d5-79e9-4308-990a-7c3e616f0908.vm-26?VpgIdentifier=57f502ff-3c41-4aff-b20a-6638205b73cd", + "rel": "self", + "type": "VmApi" + }, + "OrganizationName": "", + "OutgoingBandWidthInMbps": 0.01953125, + "Priority": 1, + "ProtectedSite": { + "href": "https://192.168.10.20:9669/v1/localsite", + "identifier": "9e09efa0-0d00-46ed-929b-f86273b28205", + "rel": null, + "type": "LocalSiteApi" + }, + "ProvisionedStorageInMB": 102400, + "RecoveryHostIdentifier": "f45d81e4-4ff5-4376-a5c8-20ffe8d52431.host-15", + "RecoverySite": { + "href": "https://192.168.10.20:9669/v1/peersites/057cab27-f02a-443a-989d-7f14341fa9c3", + "identifier": "057cab27-f02a-443a-989d-7f14341fa9c3", + "rel": null, + "type": "PeerSiteApi" + }, + "SourceSite": "WCHL - NC", + "Status": 1, + "SubStatus": 0, + "TargetSite": "WCHL - CA", + "ThroughputInMB": 0, + "UsedStorageInMB": 11747, + "VmIdentifier": "d4a6a1d5-79e9-4308-990a-7c3e616f0908.vm-26", + "VmName": "nczvm.nc.lab", + "Volumes": [ + { + "VmVolumeIdentifier": "scsi:0:0" + } + ], + "VpgIdentifier": "57f502ff-3c41-4aff-b20a-6638205b73cd", + "VpgName": "ExportStuff" + } +] diff --git a/Tests/Public/Mocks/TaskId.txt b/Tests/Public/Mocks/TaskId.txt new file mode 100644 index 0000000..6c7b99c --- /dev/null +++ b/Tests/Public/Mocks/TaskId.txt @@ -0,0 +1 @@ +7e79035e-fb8c-47fe-815c-12ddd41708e6.3e4cdd0d-1064-4022-921f-6265ad6d335a diff --git a/Tests/Public/Mocks/UnprotectedVms.json b/Tests/Public/Mocks/UnprotectedVms.json new file mode 100644 index 0000000..985c8fb --- /dev/null +++ b/Tests/Public/Mocks/UnprotectedVms.json @@ -0,0 +1,18 @@ +[ + { + "VmIdentifier": "d809de8e-deb7-45cc-b620-08030a1143e1.vm-87", + "VmName": "sql01-prod" + }, + { + "VmIdentifier": "d809de8e-deb7-45cc-b620-08030a1143e1.vm-34", + "VmName": "Ubuntu01" + }, + { + "VmIdentifier": "d809de8e-deb7-45cc-b620-08030a1143e1.vm-79", + "VmName": "Win2019Template" + }, + { + "VmIdentifier": "d809de8e-deb7-45cc-b620-08030a1143e1.vm-25", + "VmName": "WinTemplate" + } +] diff --git a/Tests/Public/Mocks/VPGInfo.json b/Tests/Public/Mocks/VPGInfo.json new file mode 100644 index 0000000..f2fae5e --- /dev/null +++ b/Tests/Public/Mocks/VPGInfo.json @@ -0,0 +1,75 @@ +{ + "ActiveProcessesApi": { + "RunningFailOverTestApi": null + }, + "ActualRPO": 6, + "BackupEnabled": false, + "ConfiguredRpoSeconds": 300, + "Entities": { + "Protected": 0, + "Recovery": 0, + "Source": 0, + "Target": 0 + }, + "FailSafeHistory": { + "ActualFailSafeHistory": 60, + "ConfiguredFailSafeHistory": 60, + "FailSafeDescription": "" + }, + "HistoryStatusApi": { + "ActualHistoryInMinutes": 225, + "ConfiguredHistoryInMinutes": 60, + "EarliestCheckpoint": { + "CheckpointIdentifier": "166834", + "Tag": null, + "TimeStamp": "2019-07-11T13:47:23Z" + } + }, + "IOPs": 8, + "LastTest": "2019-07-11T16:51:07.022Z", + "Link": { + "href": "https://192.168.222.1:7669/v1/vpgs/99c460c1-a4ec-48dd-8921-bbcca9cd29b9", + "identifier": "99c460c1-a4ec-48dd-8921-bbcca9cd29b9", + "rel": null, + "type": "VpgApi" + }, + "Link_{0}": { + "href": "https://192.168.222.1:7669/v1/vpgs/99c460c1-a4ec-48dd-8921-bbcca9cd29b9", + "rel": "self", + "type": "VpgApi" + }, + "OrganizationName": "", + "Priority": 1, + "ProgressPercentage": 0, + "ProtectedSite": { + "href": "https://192.168.222.1:7669/v1/localsite", + "identifier": "63a62dc2-ef6f-45aa-809f-9dbaeb8c06cf", + "rel": null, + "type": "LocalSiteApi" + }, + "ProvisionedStorageInMB": 400, + "RecoverySite": { + "href": "https://192.168.222.1:7669/v1/peersites/3e4cdd0d-1064-4022-921f-6265ad6d335a", + "identifier": "3e4cdd0d-1064-4022-921f-6265ad6d335a", + "rel": null, + "type": "PeerSiteApi" + }, + "ServiceProfile": null, + "ServiceProfileIdentifier": null, + "ServiceProfileName": "", + "SourceSite": "vSphere-Site01 at Zerto", + "Status": 1, + "SubStatus": 0, + "TargetSite": "vSphere-Site02 at Zerto", + "ThroughputInMB": 58.55859375, + "UsedStorageInMB": 400, + "VmsCount": 4, + "VpgIdentifier": "99c460c1-a4ec-48dd-8921-bbcca9cd29b9", + "VpgName": "Exchange", + "Zorg": { + "href": "https://192.168.222.1:7669/v1/zorgs/00000000-0000-0000-0000-000000000000", + "identifier": "00000000-0000-0000-0000-000000000000", + "rel": null, + "type": "ZorgApi" + } +} diff --git a/Tests/Public/Mocks/VirtualSite-Folders.json b/Tests/Public/Mocks/VirtualSite-Folders.json new file mode 100644 index 0000000..c14eb73 --- /dev/null +++ b/Tests/Public/Mocks/VirtualSite-Folders.json @@ -0,0 +1,14 @@ +[ + { + "FolderIdentifier": "09db6c5b-b956-430f-9589-b58876ca377a.group-v3", + "FolderName": "/" + }, + { + "FolderIdentifier": "09db6c5b-b956-430f-9589-b58876ca377a.group-v27", + "FolderName": "Templates" + }, + { + "FolderIdentifier": "09db6c5b-b956-430f-9589-b58876ca377a.group-v9", + "FolderName": "Discovered virtual machine" + } +] diff --git a/Tests/Public/Mocks/VirtualSite-Networks.json b/Tests/Public/Mocks/VirtualSite-Networks.json new file mode 100644 index 0000000..3c08c27 --- /dev/null +++ b/Tests/Public/Mocks/VirtualSite-Networks.json @@ -0,0 +1,4 @@ +{ + "NetworkIdentifier": "09db6c5b-b956-430f-9589-b58876ca377a.network-20", + "VirtualizationNetworkName": "VM Network" +} diff --git a/Tests/Public/Mocks/VirtualSite-NoParams.json b/Tests/Public/Mocks/VirtualSite-NoParams.json new file mode 100644 index 0000000..feccaa9 --- /dev/null +++ b/Tests/Public/Mocks/VirtualSite-NoParams.json @@ -0,0 +1,10 @@ +[ + { + "SiteIdentifier": "8e1c9f53-4973-4a4a-b2dd-1ebb293614d8", + "VirtualizationSiteName": "cavc.nc.lab" + }, + { + "SiteIdentifier": "15aa0d43-69cd-400a-8b99-fe94bbac3e19", + "VirtualizationSiteName": "ncvc.nc.lab" + } +] diff --git a/Tests/Public/Mocks/VirtualSite-ResourcePools.json b/Tests/Public/Mocks/VirtualSite-ResourcePools.json new file mode 100644 index 0000000..7d65eff --- /dev/null +++ b/Tests/Public/Mocks/VirtualSite-ResourcePools.json @@ -0,0 +1,4 @@ +{ + "ResourcePoolIdentifier": "09db6c5b-b956-430f-9589-b58876ca377a.resgroup-8", + "ResourcepoolName": "Resources" +} diff --git a/Tests/Public/Mocks/VirtualSite-SiteId.json b/Tests/Public/Mocks/VirtualSite-SiteId.json new file mode 100644 index 0000000..4abdcc3 --- /dev/null +++ b/Tests/Public/Mocks/VirtualSite-SiteId.json @@ -0,0 +1,4 @@ +{ + "SiteIdentifier": "8e1c9f53-4973-4a4a-b2dd-1ebb293614d8", + "VirtualizationSiteName": "cavc.nc.lab" +} diff --git a/Tests/Public/Mocks/VirtualSite-VMs.json b/Tests/Public/Mocks/VirtualSite-VMs.json new file mode 100644 index 0000000..6debd36 --- /dev/null +++ b/Tests/Public/Mocks/VirtualSite-VMs.json @@ -0,0 +1,18 @@ +[ + { + "VmIdentifier": "09db6c5b-b956-430f-9589-b58876ca377a.vm-55", + "VmName": "TimeSeries" + }, + { + "VmIdentifier": "09db6c5b-b956-430f-9589-b58876ca377a.vm-53", + "VmName": "AnsibleTarget" + }, + { + "VmIdentifier": "09db6c5b-b956-430f-9589-b58876ca377a.vm-28", + "VmName": "cazvm.nc.lab" + }, + { + "VmIdentifier": "09db6c5b-b956-430f-9589-b58876ca377a.vm-26", + "VmName": "WinTemplate" + } +] diff --git a/Tests/Public/Mocks/VirtualSite-datastoreClusters.json b/Tests/Public/Mocks/VirtualSite-datastoreClusters.json new file mode 100644 index 0000000..82a0a11 --- /dev/null +++ b/Tests/Public/Mocks/VirtualSite-datastoreClusters.json @@ -0,0 +1,4 @@ +{ + "DatastoreClusterIdentifier": "09db6c5b-b956-430f-9589-b58876ca377a.group-p44", + "DatastoreClusterName": "CA_DS_Cluster" +} diff --git a/Tests/Public/Mocks/VirtualSite-datastores.json b/Tests/Public/Mocks/VirtualSite-datastores.json new file mode 100644 index 0000000..0bdbc15 --- /dev/null +++ b/Tests/Public/Mocks/VirtualSite-datastores.json @@ -0,0 +1,34 @@ +[ + { + "DatastoreIdentifier": "09db6c5b-b956-430f-9589-b58876ca377a.datastore-40", + "DatastoreName": "MgmtLUN" + }, + { + "DatastoreIdentifier": "09db6c5b-b956-430f-9589-b58876ca377a.datastore-23", + "DatastoreName": "LabPool" + }, + { + "DatastoreIdentifier": "09db6c5b-b956-430f-9589-b58876ca377a.datastore-22", + "DatastoreName": "datastore1 (2)" + }, + { + "DatastoreIdentifier": "09db6c5b-b956-430f-9589-b58876ca377a.datastore-21", + "DatastoreName": "datastore1 (1)" + }, + { + "DatastoreIdentifier": "09db6c5b-b956-430f-9589-b58876ca377a.datastore-19", + "DatastoreName": "datastore1" + }, + { + "DatastoreIdentifier": "09db6c5b-b956-430f-9589-b58876ca377a.datastore-41", + "DatastoreName": "CA_DS_01" + }, + { + "DatastoreIdentifier": "09db6c5b-b956-430f-9589-b58876ca377a.datastore-42", + "DatastoreName": "CA_DS_02" + }, + { + "DatastoreIdentifier": "09db6c5b-b956-430f-9589-b58876ca377a.datastore-43", + "DatastoreName": "CA_DS_03" + } +] diff --git a/Tests/Public/Mocks/VirtualSite-devices-hostid.json b/Tests/Public/Mocks/VirtualSite-devices-hostid.json new file mode 100644 index 0000000..f2768c4 --- /dev/null +++ b/Tests/Public/Mocks/VirtualSite-devices-hostid.json @@ -0,0 +1,62 @@ +[ + { + "DatastoreIdentifier": "09db6c5b-b956-430f-9589-b58876ca377a.datastore-40", + "DeviceIdentifier": "09db6c5b-b956-430f-9589-b58876ca377a.naa.6001405a18009ded4f84d4177d8893d6", + "DeviceName": "SYNOLOGY iSCSI Disk (naa.6001405a18009ded4f84d4177d8893d6)", + "HostIdentifiers": [ + "09db6c5b-b956-430f-9589-b58876ca377a.host-18", + "09db6c5b-b956-430f-9589-b58876ca377a.host-15", + "09db6c5b-b956-430f-9589-b58876ca377a.host-12" + ], + "SizeInBytes": 1073741824000, + "VmIdentifier": null + }, + { + "DatastoreIdentifier": "09db6c5b-b956-430f-9589-b58876ca377a.datastore-22", + "DeviceIdentifier": "09db6c5b-b956-430f-9589-b58876ca377a.mpx.vmhba1:C0:T0:L0", + "DeviceName": "Local VMware Disk (mpx.vmhba1:C0:T0:L0)", + "HostIdentifiers": [ + "09db6c5b-b956-430f-9589-b58876ca377a.host-18", + "09db6c5b-b956-430f-9589-b58876ca377a.host-15", + "09db6c5b-b956-430f-9589-b58876ca377a.host-12" + ], + "SizeInBytes": 42949672960, + "VmIdentifier": null + }, + { + "DatastoreIdentifier": "09db6c5b-b956-430f-9589-b58876ca377a.datastore-42", + "DeviceIdentifier": "09db6c5b-b956-430f-9589-b58876ca377a.naa.6001405922cd662dc343d4683d9aecd1", + "DeviceName": "SYNOLOGY iSCSI Disk (naa.6001405922cd662dc343d4683d9aecd1)", + "HostIdentifiers": [ + "09db6c5b-b956-430f-9589-b58876ca377a.host-18", + "09db6c5b-b956-430f-9589-b58876ca377a.host-15", + "09db6c5b-b956-430f-9589-b58876ca377a.host-12" + ], + "SizeInBytes": 536870912000, + "VmIdentifier": null + }, + { + "DatastoreIdentifier": "09db6c5b-b956-430f-9589-b58876ca377a.datastore-41", + "DeviceIdentifier": "09db6c5b-b956-430f-9589-b58876ca377a.naa.6001405522c4ad5d65a6d4113d9657dc", + "DeviceName": "SYNOLOGY iSCSI Disk (naa.6001405522c4ad5d65a6d4113d9657dc)", + "HostIdentifiers": [ + "09db6c5b-b956-430f-9589-b58876ca377a.host-18", + "09db6c5b-b956-430f-9589-b58876ca377a.host-15", + "09db6c5b-b956-430f-9589-b58876ca377a.host-12" + ], + "SizeInBytes": 536870912000, + "VmIdentifier": null + }, + { + "DatastoreIdentifier": "09db6c5b-b956-430f-9589-b58876ca377a.datastore-43", + "DeviceIdentifier": "09db6c5b-b956-430f-9589-b58876ca377a.naa.600140533d732abd8caed42cfda50ed1", + "DeviceName": "SYNOLOGY iSCSI Disk (naa.600140533d732abd8caed42cfda50ed1)", + "HostIdentifiers": [ + "09db6c5b-b956-430f-9589-b58876ca377a.host-18", + "09db6c5b-b956-430f-9589-b58876ca377a.host-15", + "09db6c5b-b956-430f-9589-b58876ca377a.host-12" + ], + "SizeInBytes": 536870912000, + "VmIdentifier": null + } +] diff --git a/Tests/Public/Mocks/VirtualSite-devices.json b/Tests/Public/Mocks/VirtualSite-devices.json new file mode 100644 index 0000000..f2768c4 --- /dev/null +++ b/Tests/Public/Mocks/VirtualSite-devices.json @@ -0,0 +1,62 @@ +[ + { + "DatastoreIdentifier": "09db6c5b-b956-430f-9589-b58876ca377a.datastore-40", + "DeviceIdentifier": "09db6c5b-b956-430f-9589-b58876ca377a.naa.6001405a18009ded4f84d4177d8893d6", + "DeviceName": "SYNOLOGY iSCSI Disk (naa.6001405a18009ded4f84d4177d8893d6)", + "HostIdentifiers": [ + "09db6c5b-b956-430f-9589-b58876ca377a.host-18", + "09db6c5b-b956-430f-9589-b58876ca377a.host-15", + "09db6c5b-b956-430f-9589-b58876ca377a.host-12" + ], + "SizeInBytes": 1073741824000, + "VmIdentifier": null + }, + { + "DatastoreIdentifier": "09db6c5b-b956-430f-9589-b58876ca377a.datastore-22", + "DeviceIdentifier": "09db6c5b-b956-430f-9589-b58876ca377a.mpx.vmhba1:C0:T0:L0", + "DeviceName": "Local VMware Disk (mpx.vmhba1:C0:T0:L0)", + "HostIdentifiers": [ + "09db6c5b-b956-430f-9589-b58876ca377a.host-18", + "09db6c5b-b956-430f-9589-b58876ca377a.host-15", + "09db6c5b-b956-430f-9589-b58876ca377a.host-12" + ], + "SizeInBytes": 42949672960, + "VmIdentifier": null + }, + { + "DatastoreIdentifier": "09db6c5b-b956-430f-9589-b58876ca377a.datastore-42", + "DeviceIdentifier": "09db6c5b-b956-430f-9589-b58876ca377a.naa.6001405922cd662dc343d4683d9aecd1", + "DeviceName": "SYNOLOGY iSCSI Disk (naa.6001405922cd662dc343d4683d9aecd1)", + "HostIdentifiers": [ + "09db6c5b-b956-430f-9589-b58876ca377a.host-18", + "09db6c5b-b956-430f-9589-b58876ca377a.host-15", + "09db6c5b-b956-430f-9589-b58876ca377a.host-12" + ], + "SizeInBytes": 536870912000, + "VmIdentifier": null + }, + { + "DatastoreIdentifier": "09db6c5b-b956-430f-9589-b58876ca377a.datastore-41", + "DeviceIdentifier": "09db6c5b-b956-430f-9589-b58876ca377a.naa.6001405522c4ad5d65a6d4113d9657dc", + "DeviceName": "SYNOLOGY iSCSI Disk (naa.6001405522c4ad5d65a6d4113d9657dc)", + "HostIdentifiers": [ + "09db6c5b-b956-430f-9589-b58876ca377a.host-18", + "09db6c5b-b956-430f-9589-b58876ca377a.host-15", + "09db6c5b-b956-430f-9589-b58876ca377a.host-12" + ], + "SizeInBytes": 536870912000, + "VmIdentifier": null + }, + { + "DatastoreIdentifier": "09db6c5b-b956-430f-9589-b58876ca377a.datastore-43", + "DeviceIdentifier": "09db6c5b-b956-430f-9589-b58876ca377a.naa.600140533d732abd8caed42cfda50ed1", + "DeviceName": "SYNOLOGY iSCSI Disk (naa.600140533d732abd8caed42cfda50ed1)", + "HostIdentifiers": [ + "09db6c5b-b956-430f-9589-b58876ca377a.host-18", + "09db6c5b-b956-430f-9589-b58876ca377a.host-15", + "09db6c5b-b956-430f-9589-b58876ca377a.host-12" + ], + "SizeInBytes": 536870912000, + "VmIdentifier": null + } +] diff --git a/Tests/Public/Mocks/VirtualSite-hostClusters.json b/Tests/Public/Mocks/VirtualSite-hostClusters.json new file mode 100644 index 0000000..2a28338 --- /dev/null +++ b/Tests/Public/Mocks/VirtualSite-hostClusters.json @@ -0,0 +1,4 @@ +{ + "ClusterIdentifier": "09db6c5b-b956-430f-9589-b58876ca377a.domain-c7", + "VirtualizationClusterName": "CA Cluster" +} diff --git a/Tests/Public/Mocks/VirtualSite-hosts-hostid.json b/Tests/Public/Mocks/VirtualSite-hosts-hostid.json new file mode 100644 index 0000000..7a74266 --- /dev/null +++ b/Tests/Public/Mocks/VirtualSite-hosts-hostid.json @@ -0,0 +1,4 @@ +{ + "HostIdentifier": "09db6c5b-b956-430f-9589-b58876ca377a.host-18", + "VirtualizationHostName": "caesx3.nc.lab" +} diff --git a/Tests/Public/Mocks/VirtualSite-hosts.json b/Tests/Public/Mocks/VirtualSite-hosts.json new file mode 100644 index 0000000..8f0ba82 --- /dev/null +++ b/Tests/Public/Mocks/VirtualSite-hosts.json @@ -0,0 +1,14 @@ +[ + { + "HostIdentifier": "09db6c5b-b956-430f-9589-b58876ca377a.host-18", + "VirtualizationHostName": "caesx3.nc.lab" + }, + { + "HostIdentifier": "09db6c5b-b956-430f-9589-b58876ca377a.host-15", + "VirtualizationHostName": "caesx2.nc.lab" + }, + { + "HostIdentifier": "09db6c5b-b956-430f-9589-b58876ca377a.host-12", + "VirtualizationHostName": "caesx1.nc.lab" + } +] diff --git a/Tests/Public/Mocks/VirtualSite-repositories.json b/Tests/Public/Mocks/VirtualSite-repositories.json new file mode 100644 index 0000000..95b7921 --- /dev/null +++ b/Tests/Public/Mocks/VirtualSite-repositories.json @@ -0,0 +1,7 @@ +{ + "ConnectionType": "ServerMessageBlock", + "Path": "\\\\192.168.1.150\\zBackups", + "RepositoryIdentifier": "120355ce-fcd0-4820-a971-787d0470793b", + "RepositoryName": "Synology", + "StorageType": "NetworkShare" +} diff --git a/Tests/Public/Mocks/VpgId.txt b/Tests/Public/Mocks/VpgId.txt new file mode 100644 index 0000000..d6714d6 --- /dev/null +++ b/Tests/Public/Mocks/VpgId.txt @@ -0,0 +1 @@ +9607f923-00a7-477b-8b04-26a386214455 diff --git a/Tests/Public/Mocks/ZAToken.json b/Tests/Public/Mocks/ZAToken.json new file mode 100644 index 0000000..335aa89 --- /dev/null +++ b/Tests/Public/Mocks/ZAToken.json @@ -0,0 +1,4 @@ +{ + "type": "Bearer", + "token": "N074r34l70k3n" +} diff --git a/Tests/Public/New-ZertoPairingToken.Tests.ps1 b/Tests/Public/New-ZertoPairingToken.Tests.ps1 new file mode 100644 index 0000000..8d69a2c --- /dev/null +++ b/Tests/Public/New-ZertoPairingToken.Tests.ps1 @@ -0,0 +1,51 @@ +#Requires -Modules Pester +$global:here = (Split-Path -Parent $PSCommandPath) +$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0] + +Describe $global:function -Tag 'Unit', 'Source', 'Built' { + BeforeAll { + $script:ScriptBlock = (Get-Command $global:function).ScriptBlock + } + + Context "$global:function::Parameter Unit Tests" { + It "$global:function should have exactly 13 parameters defined" { + (Get-Command $global:function).Parameters.Count | Should -Be 13 + } + + It "Supports 'SupportsShouldProcess'" { + Get-Command $global:function | Should -HaveParameter WhatIf + Get-Command $global:function | Should -HaveParameter Confirm + $script:ScriptBlock | Should -match 'SupportsShouldProcess' + $script:ScriptBlock | Should -match '\$PSCmdlet\.ShouldProcess\(.+\)' + } + } + + Context "$global:function::Parameter Functional Tests" { + Mock -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest { + return (Get-Content -Raw "$global:here\Mocks\PairingToken.json" | ConvertFrom-Json) + } + + It "Returns a Token" { + $Token = New-ZertoPairingToken + $Token | Should -Not -Be $Null + $Token.Token | Should -Be "TH15ISN0T4R3AL70KEN" + } + + It "Returns a ExpirationDate" { + $Token = New-ZertoPairingToken + $Token | Should -Not -Be $Null + $Token.UtcExpirationDate | Should -Be "10/09/2019 12:55 PM" + } + + It "Does not return a taskId if '-whatif' is used" { + $results = New-ZertoPairingToken -WhatIf + $results | Should -BeNullOrEmpty + } + + Assert-MockCalled -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -Exactly 2 + + } +} + +Remove-Variable -Name here -Scope Global +Remove-Variable -Name function -Scope Global diff --git a/Tests/Public/New-ZertoVpg.Tests.ps1 b/Tests/Public/New-ZertoVpg.Tests.ps1 index 50d2f9d..770482b 100644 --- a/Tests/Public/New-ZertoVpg.Tests.ps1 +++ b/Tests/Public/New-ZertoVpg.Tests.ps1 @@ -1,19 +1,17 @@ #Requires -Modules Pester -$moduleFileName = "ZertoApiWrapper.psd1" -$here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper") -$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".") -$file = Get-ChildItem "$here\$sut" -$modulePath = $here -replace "Public", "" -$moduleFile = Get-ChildItem "$modulePath\$moduleFileName" -Get-Module -Name ZertoApiWrapper | Remove-Module -Force -Import-Module $moduleFile -Force +$global:here = (Split-Path -Parent $PSCommandPath) +$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0] -Describe $file.BaseName -Tag 'Unit' { +Describe $global:function -Tag 'Unit', 'Source', 'Built' { + + Context "$global:function::Parameter Unit Tests" { - It "is valid Powershell (Has no script errors)" { - $contents = Get-Content -Path $file -ErrorAction Stop - $errors = $null - $null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors) - $errors | Should -HaveCount 0 } -} \ No newline at end of file + + Context "$global:function::Parameter Functional Tests" { + + } +} + +Remove-Variable -Name here -Scope Global +Remove-Variable -Name function -Scope Global diff --git a/Tests/Public/New-ZertoVpgSettingsIdentifier.Tests.ps1 b/Tests/Public/New-ZertoVpgSettingsIdentifier.Tests.ps1 index 50d2f9d..770482b 100644 --- a/Tests/Public/New-ZertoVpgSettingsIdentifier.Tests.ps1 +++ b/Tests/Public/New-ZertoVpgSettingsIdentifier.Tests.ps1 @@ -1,19 +1,17 @@ #Requires -Modules Pester -$moduleFileName = "ZertoApiWrapper.psd1" -$here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper") -$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".") -$file = Get-ChildItem "$here\$sut" -$modulePath = $here -replace "Public", "" -$moduleFile = Get-ChildItem "$modulePath\$moduleFileName" -Get-Module -Name ZertoApiWrapper | Remove-Module -Force -Import-Module $moduleFile -Force +$global:here = (Split-Path -Parent $PSCommandPath) +$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0] -Describe $file.BaseName -Tag 'Unit' { +Describe $global:function -Tag 'Unit', 'Source', 'Built' { + + Context "$global:function::Parameter Unit Tests" { - It "is valid Powershell (Has no script errors)" { - $contents = Get-Content -Path $file -ErrorAction Stop - $errors = $null - $null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors) - $errors | Should -HaveCount 0 } -} \ No newline at end of file + + Context "$global:function::Parameter Functional Tests" { + + } +} + +Remove-Variable -Name here -Scope Global +Remove-Variable -Name function -Scope Global diff --git a/Tests/Public/Remove-ZertoPeerSite.Tests.ps1 b/Tests/Public/Remove-ZertoPeerSite.Tests.ps1 index 50d2f9d..770482b 100644 --- a/Tests/Public/Remove-ZertoPeerSite.Tests.ps1 +++ b/Tests/Public/Remove-ZertoPeerSite.Tests.ps1 @@ -1,19 +1,17 @@ #Requires -Modules Pester -$moduleFileName = "ZertoApiWrapper.psd1" -$here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper") -$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".") -$file = Get-ChildItem "$here\$sut" -$modulePath = $here -replace "Public", "" -$moduleFile = Get-ChildItem "$modulePath\$moduleFileName" -Get-Module -Name ZertoApiWrapper | Remove-Module -Force -Import-Module $moduleFile -Force +$global:here = (Split-Path -Parent $PSCommandPath) +$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0] -Describe $file.BaseName -Tag 'Unit' { +Describe $global:function -Tag 'Unit', 'Source', 'Built' { + + Context "$global:function::Parameter Unit Tests" { - It "is valid Powershell (Has no script errors)" { - $contents = Get-Content -Path $file -ErrorAction Stop - $errors = $null - $null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors) - $errors | Should -HaveCount 0 } -} \ No newline at end of file + + Context "$global:function::Parameter Functional Tests" { + + } +} + +Remove-Variable -Name here -Scope Global +Remove-Variable -Name function -Scope Global diff --git a/Tests/Public/Remove-ZertoVpg.Tests.ps1 b/Tests/Public/Remove-ZertoVpg.Tests.ps1 index 50d2f9d..770482b 100644 --- a/Tests/Public/Remove-ZertoVpg.Tests.ps1 +++ b/Tests/Public/Remove-ZertoVpg.Tests.ps1 @@ -1,19 +1,17 @@ #Requires -Modules Pester -$moduleFileName = "ZertoApiWrapper.psd1" -$here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper") -$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".") -$file = Get-ChildItem "$here\$sut" -$modulePath = $here -replace "Public", "" -$moduleFile = Get-ChildItem "$modulePath\$moduleFileName" -Get-Module -Name ZertoApiWrapper | Remove-Module -Force -Import-Module $moduleFile -Force +$global:here = (Split-Path -Parent $PSCommandPath) +$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0] -Describe $file.BaseName -Tag 'Unit' { +Describe $global:function -Tag 'Unit', 'Source', 'Built' { + + Context "$global:function::Parameter Unit Tests" { - It "is valid Powershell (Has no script errors)" { - $contents = Get-Content -Path $file -ErrorAction Stop - $errors = $null - $null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors) - $errors | Should -HaveCount 0 } -} \ No newline at end of file + + Context "$global:function::Parameter Functional Tests" { + + } +} + +Remove-Variable -Name here -Scope Global +Remove-Variable -Name function -Scope Global diff --git a/Tests/Public/Remove-ZertoVpgSettingsIdentifier.Tests.ps1 b/Tests/Public/Remove-ZertoVpgSettingsIdentifier.Tests.ps1 new file mode 100644 index 0000000..770482b --- /dev/null +++ b/Tests/Public/Remove-ZertoVpgSettingsIdentifier.Tests.ps1 @@ -0,0 +1,17 @@ +#Requires -Modules Pester +$global:here = (Split-Path -Parent $PSCommandPath) +$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0] + +Describe $global:function -Tag 'Unit', 'Source', 'Built' { + + Context "$global:function::Parameter Unit Tests" { + + } + + Context "$global:function::Parameter Functional Tests" { + + } +} + +Remove-Variable -Name here -Scope Global +Remove-Variable -Name function -Scope Global diff --git a/Tests/Public/Remove-ZertoVpgVm.Tests.ps1 b/Tests/Public/Remove-ZertoVpgVm.Tests.ps1 new file mode 100644 index 0000000..12d2860 --- /dev/null +++ b/Tests/Public/Remove-ZertoVpgVm.Tests.ps1 @@ -0,0 +1,52 @@ +#Requires -Modules Pester +$global:here = (Split-Path -Parent $PSCommandPath) +$global:function = ((Split-Path -Leaf $PSCommandPath).Split('.'))[0] + +Describe $global:function -Tag 'Unit', 'Source', 'Built' { + BeforeAll { + $script:ScriptBlock = (Get-Command $global:function).ScriptBlock + } + + Context "$global:function::Parameter Unit Tests" { + + It "$global:function should have exactly 15 parameters defined" { + (Get-Command $global:function).Parameters.Count | Should -Be 15 + } + + $ParameterTestCases = @( + @{ParameterName = 'Vm'; Type = 'String[]'; Mandatory = $true; Validation = 'NotNullOrEmpty' } + @{ParameterName = 'VpgName'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' } + ) + + It " parameter is of type" -TestCases $ParameterTestCases { + param($ParameterName, $Type, $Mandatory, $Validation) + Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type + } + + It " parameter has correct validation setting" -TestCases $ParameterTestCases { + param($ParameterName, $Validation) + Switch ($Validation) { + 'NotNullOrEmpty' { + $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes + $attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1 + } + + default { + $true | Should -Be $false -Because "No Validation Selected. Review test cases" + } + } + } + + It "Supports 'SupportsShouldProcess'" { + Get-Command $global:function | Should -HaveParameter WhatIf + Get-Command $global:function | Should -HaveParameter Confirm + $script:ScriptBlock | Should -Match 'SupportsShouldProcess' + $script:ScriptBlock | Should -Match '\$PSCmdlet\.ShouldProcess\(.+\)' + } + } + + Context "Add-ZertoPeerSite::Functional Unit Tests" { + } +} +Remove-Variable -Name here -Scope Global +Remove-Variable -Name function -Scope Global diff --git a/Tests/Public/Resume-ZertoVpg.Tests.ps1 b/Tests/Public/Resume-ZertoVpg.Tests.ps1 index 50d2f9d..770482b 100644 --- a/Tests/Public/Resume-ZertoVpg.Tests.ps1 +++ b/Tests/Public/Resume-ZertoVpg.Tests.ps1 @@ -1,19 +1,17 @@ #Requires -Modules Pester -$moduleFileName = "ZertoApiWrapper.psd1" -$here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper") -$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".") -$file = Get-ChildItem "$here\$sut" -$modulePath = $here -replace "Public", "" -$moduleFile = Get-ChildItem "$modulePath\$moduleFileName" -Get-Module -Name ZertoApiWrapper | Remove-Module -Force -Import-Module $moduleFile -Force +$global:here = (Split-Path -Parent $PSCommandPath) +$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0] -Describe $file.BaseName -Tag 'Unit' { +Describe $global:function -Tag 'Unit', 'Source', 'Built' { + + Context "$global:function::Parameter Unit Tests" { - It "is valid Powershell (Has no script errors)" { - $contents = Get-Content -Path $file -ErrorAction Stop - $errors = $null - $null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors) - $errors | Should -HaveCount 0 } -} \ No newline at end of file + + Context "$global:function::Parameter Functional Tests" { + + } +} + +Remove-Variable -Name here -Scope Global +Remove-Variable -Name function -Scope Global diff --git a/Tests/Public/Save-ZertoVpgSetting.Tests.ps1 b/Tests/Public/Save-ZertoVpgSetting.Tests.ps1 index 50d2f9d..770482b 100644 --- a/Tests/Public/Save-ZertoVpgSetting.Tests.ps1 +++ b/Tests/Public/Save-ZertoVpgSetting.Tests.ps1 @@ -1,19 +1,17 @@ #Requires -Modules Pester -$moduleFileName = "ZertoApiWrapper.psd1" -$here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper") -$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".") -$file = Get-ChildItem "$here\$sut" -$modulePath = $here -replace "Public", "" -$moduleFile = Get-ChildItem "$modulePath\$moduleFileName" -Get-Module -Name ZertoApiWrapper | Remove-Module -Force -Import-Module $moduleFile -Force +$global:here = (Split-Path -Parent $PSCommandPath) +$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0] -Describe $file.BaseName -Tag 'Unit' { +Describe $global:function -Tag 'Unit', 'Source', 'Built' { + + Context "$global:function::Parameter Unit Tests" { - It "is valid Powershell (Has no script errors)" { - $contents = Get-Content -Path $file -ErrorAction Stop - $errors = $null - $null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors) - $errors | Should -HaveCount 0 } -} \ No newline at end of file + + Context "$global:function::Parameter Functional Tests" { + + } +} + +Remove-Variable -Name here -Scope Global +Remove-Variable -Name function -Scope Global diff --git a/Tests/Public/Set-ZertoAlert.Tests.ps1 b/Tests/Public/Set-ZertoAlert.Tests.ps1 index 50d2f9d..770482b 100644 --- a/Tests/Public/Set-ZertoAlert.Tests.ps1 +++ b/Tests/Public/Set-ZertoAlert.Tests.ps1 @@ -1,19 +1,17 @@ #Requires -Modules Pester -$moduleFileName = "ZertoApiWrapper.psd1" -$here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper") -$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".") -$file = Get-ChildItem "$here\$sut" -$modulePath = $here -replace "Public", "" -$moduleFile = Get-ChildItem "$modulePath\$moduleFileName" -Get-Module -Name ZertoApiWrapper | Remove-Module -Force -Import-Module $moduleFile -Force +$global:here = (Split-Path -Parent $PSCommandPath) +$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0] -Describe $file.BaseName -Tag 'Unit' { +Describe $global:function -Tag 'Unit', 'Source', 'Built' { + + Context "$global:function::Parameter Unit Tests" { - It "is valid Powershell (Has no script errors)" { - $contents = Get-Content -Path $file -ErrorAction Stop - $errors = $null - $null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors) - $errors | Should -HaveCount 0 } -} \ No newline at end of file + + Context "$global:function::Parameter Functional Tests" { + + } +} + +Remove-Variable -Name here -Scope Global +Remove-Variable -Name function -Scope Global diff --git a/Tests/Public/Set-ZertoLicense.Tests.ps1 b/Tests/Public/Set-ZertoLicense.Tests.ps1 index 50d2f9d..770482b 100644 --- a/Tests/Public/Set-ZertoLicense.Tests.ps1 +++ b/Tests/Public/Set-ZertoLicense.Tests.ps1 @@ -1,19 +1,17 @@ #Requires -Modules Pester -$moduleFileName = "ZertoApiWrapper.psd1" -$here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper") -$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".") -$file = Get-ChildItem "$here\$sut" -$modulePath = $here -replace "Public", "" -$moduleFile = Get-ChildItem "$modulePath\$moduleFileName" -Get-Module -Name ZertoApiWrapper | Remove-Module -Force -Import-Module $moduleFile -Force +$global:here = (Split-Path -Parent $PSCommandPath) +$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0] -Describe $file.BaseName -Tag 'Unit' { +Describe $global:function -Tag 'Unit', 'Source', 'Built' { + + Context "$global:function::Parameter Unit Tests" { - It "is valid Powershell (Has no script errors)" { - $contents = Get-Content -Path $file -ErrorAction Stop - $errors = $null - $null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors) - $errors | Should -HaveCount 0 } -} \ No newline at end of file + + Context "$global:function::Parameter Functional Tests" { + + } +} + +Remove-Variable -Name here -Scope Global +Remove-Variable -Name function -Scope Global diff --git a/Tests/Public/Set-ZertoUserCredential.Tests.ps1 b/Tests/Public/Set-ZertoUserCredential.Tests.ps1 new file mode 100644 index 0000000..74cc8ac --- /dev/null +++ b/Tests/Public/Set-ZertoUserCredential.Tests.ps1 @@ -0,0 +1,42 @@ +#Requires -Modules Pester +$global:here = (Split-Path -Parent $PSCommandPath) +$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0] + +Describe $global:function -Tag 'Unit', 'Source', 'Built' { + InModuleScope -ModuleName ZertoApiWrapper { + + Context "$global:function::Parameter Unit Tests" { + + BeforeAll { + $script:ScriptBlock = (Get-Command $global:function).ScriptBlock + } + + It "$global:function should have exactly 14 parameters defined" { + (Get-Command $global:function).Parameters.Count | Should -Be 14 + } + + $ParameterTestCases = @( + @{ParameterName = 'UserCredential'; Type = 'pscredential'; Mandatory = $true } + ) + + It " parameter is of type" -TestCases $ParameterTestCases { + param($ParameterName, $Type, $Mandatory, $Validation) + Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type + } + + It "Supports 'SupportsShouldProcess'" { + Get-Command $global:function | Should -HaveParameter WhatIf + Get-Command $global:function | Should -HaveParameter Confirm + $script:ScriptBlock | Should -match 'SupportsShouldProcess' + $script:ScriptBlock | Should -match '\$PSCmdlet\.ShouldProcess\(.+\)' + } + } + + Context "$global:function::Parameter Functional Tests" { + + } + } +} + +Remove-Variable -Name here -Scope Global +Remove-Variable -Name function -Scope Global diff --git a/Tests/Public/Start-ZertoCloneVpg.Tests.ps1 b/Tests/Public/Start-ZertoCloneVpg.Tests.ps1 index 50d2f9d..770482b 100644 --- a/Tests/Public/Start-ZertoCloneVpg.Tests.ps1 +++ b/Tests/Public/Start-ZertoCloneVpg.Tests.ps1 @@ -1,19 +1,17 @@ #Requires -Modules Pester -$moduleFileName = "ZertoApiWrapper.psd1" -$here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper") -$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".") -$file = Get-ChildItem "$here\$sut" -$modulePath = $here -replace "Public", "" -$moduleFile = Get-ChildItem "$modulePath\$moduleFileName" -Get-Module -Name ZertoApiWrapper | Remove-Module -Force -Import-Module $moduleFile -Force +$global:here = (Split-Path -Parent $PSCommandPath) +$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0] -Describe $file.BaseName -Tag 'Unit' { +Describe $global:function -Tag 'Unit', 'Source', 'Built' { + + Context "$global:function::Parameter Unit Tests" { - It "is valid Powershell (Has no script errors)" { - $contents = Get-Content -Path $file -ErrorAction Stop - $errors = $null - $null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors) - $errors | Should -HaveCount 0 } -} \ No newline at end of file + + Context "$global:function::Parameter Functional Tests" { + + } +} + +Remove-Variable -Name here -Scope Global +Remove-Variable -Name function -Scope Global diff --git a/Tests/Public/Start-ZertoFailoverTest.Tests.ps1 b/Tests/Public/Start-ZertoFailoverTest.Tests.ps1 index 50d2f9d..770482b 100644 --- a/Tests/Public/Start-ZertoFailoverTest.Tests.ps1 +++ b/Tests/Public/Start-ZertoFailoverTest.Tests.ps1 @@ -1,19 +1,17 @@ #Requires -Modules Pester -$moduleFileName = "ZertoApiWrapper.psd1" -$here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper") -$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".") -$file = Get-ChildItem "$here\$sut" -$modulePath = $here -replace "Public", "" -$moduleFile = Get-ChildItem "$modulePath\$moduleFileName" -Get-Module -Name ZertoApiWrapper | Remove-Module -Force -Import-Module $moduleFile -Force +$global:here = (Split-Path -Parent $PSCommandPath) +$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0] -Describe $file.BaseName -Tag 'Unit' { +Describe $global:function -Tag 'Unit', 'Source', 'Built' { + + Context "$global:function::Parameter Unit Tests" { - It "is valid Powershell (Has no script errors)" { - $contents = Get-Content -Path $file -ErrorAction Stop - $errors = $null - $null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors) - $errors | Should -HaveCount 0 } -} \ No newline at end of file + + Context "$global:function::Parameter Functional Tests" { + + } +} + +Remove-Variable -Name here -Scope Global +Remove-Variable -Name function -Scope Global diff --git a/Tests/Public/Stop-ZertoCloneVpg.Tests.ps1 b/Tests/Public/Stop-ZertoCloneVpg.Tests.ps1 index 50d2f9d..770482b 100644 --- a/Tests/Public/Stop-ZertoCloneVpg.Tests.ps1 +++ b/Tests/Public/Stop-ZertoCloneVpg.Tests.ps1 @@ -1,19 +1,17 @@ #Requires -Modules Pester -$moduleFileName = "ZertoApiWrapper.psd1" -$here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper") -$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".") -$file = Get-ChildItem "$here\$sut" -$modulePath = $here -replace "Public", "" -$moduleFile = Get-ChildItem "$modulePath\$moduleFileName" -Get-Module -Name ZertoApiWrapper | Remove-Module -Force -Import-Module $moduleFile -Force +$global:here = (Split-Path -Parent $PSCommandPath) +$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0] -Describe $file.BaseName -Tag 'Unit' { +Describe $global:function -Tag 'Unit', 'Source', 'Built' { + + Context "$global:function::Parameter Unit Tests" { - It "is valid Powershell (Has no script errors)" { - $contents = Get-Content -Path $file -ErrorAction Stop - $errors = $null - $null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors) - $errors | Should -HaveCount 0 } -} \ No newline at end of file + + Context "$global:function::Parameter Functional Tests" { + + } +} + +Remove-Variable -Name here -Scope Global +Remove-Variable -Name function -Scope Global diff --git a/Tests/Public/Stop-ZertoFailoverTest.Tests.ps1 b/Tests/Public/Stop-ZertoFailoverTest.Tests.ps1 index 50d2f9d..770482b 100644 --- a/Tests/Public/Stop-ZertoFailoverTest.Tests.ps1 +++ b/Tests/Public/Stop-ZertoFailoverTest.Tests.ps1 @@ -1,19 +1,17 @@ #Requires -Modules Pester -$moduleFileName = "ZertoApiWrapper.psd1" -$here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper") -$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".") -$file = Get-ChildItem "$here\$sut" -$modulePath = $here -replace "Public", "" -$moduleFile = Get-ChildItem "$modulePath\$moduleFileName" -Get-Module -Name ZertoApiWrapper | Remove-Module -Force -Import-Module $moduleFile -Force +$global:here = (Split-Path -Parent $PSCommandPath) +$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0] -Describe $file.BaseName -Tag 'Unit' { +Describe $global:function -Tag 'Unit', 'Source', 'Built' { + + Context "$global:function::Parameter Unit Tests" { - It "is valid Powershell (Has no script errors)" { - $contents = Get-Content -Path $file -ErrorAction Stop - $errors = $null - $null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors) - $errors | Should -HaveCount 0 } -} \ No newline at end of file + + Context "$global:function::Parameter Functional Tests" { + + } +} + +Remove-Variable -Name here -Scope Global +Remove-Variable -Name function -Scope Global diff --git a/Tests/Public/Suspend-ZertoVpg.Tests.ps1 b/Tests/Public/Suspend-ZertoVpg.Tests.ps1 index 50d2f9d..770482b 100644 --- a/Tests/Public/Suspend-ZertoVpg.Tests.ps1 +++ b/Tests/Public/Suspend-ZertoVpg.Tests.ps1 @@ -1,19 +1,17 @@ #Requires -Modules Pester -$moduleFileName = "ZertoApiWrapper.psd1" -$here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper") -$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".") -$file = Get-ChildItem "$here\$sut" -$modulePath = $here -replace "Public", "" -$moduleFile = Get-ChildItem "$modulePath\$moduleFileName" -Get-Module -Name ZertoApiWrapper | Remove-Module -Force -Import-Module $moduleFile -Force +$global:here = (Split-Path -Parent $PSCommandPath) +$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0] -Describe $file.BaseName -Tag 'Unit' { +Describe $global:function -Tag 'Unit', 'Source', 'Built' { + + Context "$global:function::Parameter Unit Tests" { - It "is valid Powershell (Has no script errors)" { - $contents = Get-Content -Path $file -ErrorAction Stop - $errors = $null - $null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors) - $errors | Should -HaveCount 0 } -} \ No newline at end of file + + Context "$global:function::Parameter Functional Tests" { + + } +} + +Remove-Variable -Name here -Scope Global +Remove-Variable -Name function -Scope Global diff --git a/Tests/Public/Uninstall-ZertoVra.Tests.ps1 b/Tests/Public/Uninstall-ZertoVra.Tests.ps1 index 50d2f9d..770482b 100644 --- a/Tests/Public/Uninstall-ZertoVra.Tests.ps1 +++ b/Tests/Public/Uninstall-ZertoVra.Tests.ps1 @@ -1,19 +1,17 @@ #Requires -Modules Pester -$moduleFileName = "ZertoApiWrapper.psd1" -$here = (Split-Path -Parent $MyInvocation.MyCommand.Path).Replace("Tests", "ZertoApiWrapper") -$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".") -$file = Get-ChildItem "$here\$sut" -$modulePath = $here -replace "Public", "" -$moduleFile = Get-ChildItem "$modulePath\$moduleFileName" -Get-Module -Name ZertoApiWrapper | Remove-Module -Force -Import-Module $moduleFile -Force +$global:here = (Split-Path -Parent $PSCommandPath) +$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0] -Describe $file.BaseName -Tag 'Unit' { +Describe $global:function -Tag 'Unit', 'Source', 'Built' { + + Context "$global:function::Parameter Unit Tests" { - It "is valid Powershell (Has no script errors)" { - $contents = Get-Content -Path $file -ErrorAction Stop - $errors = $null - $null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors) - $errors | Should -HaveCount 0 } -} \ No newline at end of file + + Context "$global:function::Parameter Functional Tests" { + + } +} + +Remove-Variable -Name here -Scope Global +Remove-Variable -Name function -Scope Global diff --git a/Tests/ZertoApiWrapper.Tests.ps1 b/Tests/ZertoApiWrapper.Tests.ps1 index bcbb9ca..0f398ae 100644 --- a/Tests/ZertoApiWrapper.Tests.ps1 +++ b/Tests/ZertoApiWrapper.Tests.ps1 @@ -1,5 +1,5 @@ #Requires -Modules Pester -$testPath = Split-Path -Parent $MyInvocation.MyCommand.Path +$testPath = Split-Path -Parent $PSCommandPath $docsPath = $testPath -replace 'Tests', 'docs' $modulePath = $testPath -replace 'Tests', 'ZertoApiWrapper' $module = Split-Path -Leaf $modulePath @@ -9,7 +9,7 @@ Describe "Module: $module" -Tags 'Unit' { Context "Module Configuration" { It "Has a root module file ($module.psm1)" { - "$modulePath\$module.psm1" | should -Exist + "$modulePath\$module.psm1" | Should -Exist } It "Is valid Powershell (Has no script errors)" { @@ -75,20 +75,20 @@ Describe "Module: $module" -Tags 'Unit' { $externalHelpFile | Should -Exist } - it "External Help file does not contain place holder values" { - $stubExist = Get-Content -Path $externalHelpFile | Where-Object {$_.Trim() -like '*{{*}}*'} + It "External Help file does not contain place holder values" { + $stubExist = Get-Content -Path $externalHelpFile | Where-Object { $_.Trim() -like '*{{*}}*' } if ($stubExist) { Write-Warning "Found a stub in the Markdown File $externalHelpFile" Write-Warning "$stubExist" } - $stubExist | should benullorempty + $stubExist | Should benullorempty } } It "Is an advanced function" { - $Function.FullName | should -FileContentMatch 'function' - $Function.FullName | should -FileContentMatch 'cmdletbinding' - $Function.FullName | should -FileContentMatch 'param' + $Function.FullName | Should -FileContentMatch 'function' + $Function.FullName | Should -FileContentMatch 'cmdletbinding' + $Function.FullName | Should -FileContentMatch 'param' } It "Is valid Powershell (Has no script errors)" { @@ -97,15 +97,15 @@ Describe "Module: $module" -Tags 'Unit' { $errors | Should -HaveCount 0 } - it "Has openbraces on the same line as the statement" { - $openingBracesExist = $contents | Where-Object {$_.Trim() -eq '{'} + It "Has openbraces on the same line as the statement" { + $openingBracesExist = $contents | Where-Object { $_.Trim() -eq '{' } if ($openingBracesExist) { Write-Warning "Found the following opening brances on their own line:" foreach ($openingBrace in $openingBracesExist) { Write-Warning "Opening Brace on it's own line - $openingBrace" } } - $openingBracesExist | should -BeNullOrEmpty + $openingBracesExist | Should -BeNullOrEmpty } } } diff --git a/ZertoApiWrapper.Depend.psd1 b/ZertoApiWrapper.Depend.psd1 index 196f108..e3f8356 100644 --- a/ZertoApiWrapper.Depend.psd1 +++ b/ZertoApiWrapper.Depend.psd1 @@ -7,7 +7,7 @@ SkipPublisherCheck = $true } Target = 'CurrentUser' - Version = '5.5.1' + Version = '5.6.0' Tags = 'Bootstrap' } @@ -19,7 +19,7 @@ SkipPublisherCheck = $true } Target = 'CurrentUser' - Version = '4.7.3' + Version = '4.10.1' Tags = 'Bootstrap' } @@ -31,7 +31,7 @@ SkipPublisherCheck = $true } Target = 'CurrentUser' - Version = '1.18.0' + Version = '1.19.0' Tags = 'Bootstrap' } diff --git a/ZertoApiWrapper.build.ps1 b/ZertoApiWrapper.build.ps1 index 9a9ad17..08efbac 100644 --- a/ZertoApiWrapper.build.ps1 +++ b/ZertoApiWrapper.build.ps1 @@ -1,16 +1,28 @@ #Requires -Modules 'InvokeBuild' -. '.\ZertoApiWrapper.settings.ps1' -# import-module "$BuildRoot\ZertoApiWrapper\ZertoApiWrapper.psd1" -Verbose -Force +$version = "{0}" -f $(Get-Content .\version.txt) +$moduleOutPath = "{0}\publish\ZertoApiWrapper" -f $BuildRoot -<# [CmdletBinding()] -param([switch]$Install, - [string]$Configuration = (property Configuration Release)) -$targetDir = "temp/$Configuration/ZertoApiWrapper" #> -$version = "{0}.{1}" -f $(Get-Content .\version.txt), $(get-date -format 'yyyyMMdd') +#Define the default task +task . build -task . CreateArtifacts +#Region - Helper Functions +function ImportSourceModule { + If (Get-Module -Name ZertoApiWrapper) { + Remove-Module -Name ZertoApiWrapper -Force -ErrorAction Stop + } + Import-Module "$BuildRoot\ZertoApiWrapper\ZertoApiWrapper.psd1" -ErrorAction Stop +} + +function ImportBuiltModule { + If (Get-Module -Name ZertoApiWrapper) { + Remove-Module -Name ZertoApiWrapper -Force -ErrorAction Stop + } + Import-Module ("{0}\ZertoApiWrapper.psd1" -f $moduleOutPath) -ErrorAction Stop +} +#EndRegion +#Region - Module Checks <# Synopsis: Ensure platyPS is installed #> task CheckPlatyPSInstalled { if ($null -eq (Get-Module -List platyPS)) { @@ -20,9 +32,11 @@ task CheckPlatyPSInstalled { <# Synopsis: Ensure Pester is installed #> task CheckPesterInstalled { + Get-Module -Name Pester | Remove-Module -Force if ($null -eq (Get-Module -List Pester)) { - Install-Module -Scope CurrentUser -Repository PSGallery -Name Pester + Install-Module -Scope CurrentUser -Repository PSGallery -Name Pester -MaximumVersion 4.99 } + Import-Module -Name Pester -MaximumVersion 4.99 -Force } <# Synopsis: Ensure PSScriptAnalyzer is installed #> @@ -31,7 +45,9 @@ task CheckPSScriptAnalyzerInstalled { Install-Module -Scope CurrentUser -Repository PSGallery -Name PSScriptAnalyzer } } +#EndRegion +#Region - PSSA Tasks <# Synopsis: Analyze ZertoApiWrapper functions for Code Violations #> task AnalyzeSourceFiles CheckPSScriptAnalyzerInstalled, { $scriptAnalyzerParams = @{ @@ -39,7 +55,7 @@ task AnalyzeSourceFiles CheckPSScriptAnalyzerInstalled, { Severity = @('Error', 'Warning') Recurse = $true Verbose = $false - ExcludeRule = @('PSUseDeclaredVarsMoreThanAssignments', 'PSUseShouldProcessForStateChangingFunctions', 'PSUseToExportFieldsInManifest') + ExcludeRule = @('PSUseToExportFieldsInManifest', 'PSUseBOMForUnicodeEncodedFile', 'PSUseSingularNouns', 'PSReviewUnusedParameter') } $saresults = Invoke-ScriptAnalyzer @scriptAnalyzerParams if ($saResults) { @@ -50,11 +66,11 @@ task AnalyzeSourceFiles CheckPSScriptAnalyzerInstalled, { task AnalyzeBuiltFiles CheckPSScriptAnalyzerInstalled, CreatePsm1ForRelease, { $scriptAnalyzerParams = @{ - Path = "$BuildRoot\temp\" + Path = $moduleOutPath Severity = @('Error', 'Warning') Recurse = $true Verbose = $false - ExcludeRule = @() + ExcludeRule = @('PSUseSingularNouns', 'PSUseBOMForUnicodeEncodedFile', 'PSReviewUnusedParameter') } $saresults = Invoke-ScriptAnalyzer @scriptAnalyzerParams @@ -63,17 +79,41 @@ task AnalyzeBuiltFiles CheckPSScriptAnalyzerInstalled, CreatePsm1ForRelease, { throw "One or more PSScriptAnalyzer errors/warnings were found" } } +#EndRegion + +#Region - Clean Operations +task CleanPublish { + if ($(Test-Path "$BuildRoot\publish")) { + Remove-Item -Recurse -Path "$BuildRoot\publish\*" + } else { + New-Item -Path $BuildRoot -Name "publish" -ItemType Directory + } + New-Item -Path $moduleOutPath -ItemType "Directory" +} +#EndRegion + +#Region - Pester Tests +task SourceFileTests CheckPesterInstalled, { + ImportSourceModule + $testResultsFile = "$BuildRoot\Tests\SourceTestResults.xml" + $script:results = Invoke-Pester -Script "$BuildRoot" -Tag Unit -OutputFile $testResultsFile -PassThru -Show Fails + $FailureMessage = '{0} Unit test(s) failed. Aborting build' -f $results.FailedCount + Assert ($results.FailedCount -eq 0) $FailureMessage +} -task FileTests CheckPesterInstalled, { - $testResultsFile = "$BuildRoot\Tests\TestResults.xml" - $script:results = Invoke-Pester -Script "$BuildRoot" -Tag Unit -OutputFile $testResultsFile -PassThru +task BuiltFileTests CreatePsm1ForRelease, CheckPesterInstalled, { + ImportBuiltModule + $testResultsFile = "$BuildRoot\Tests\BuiltTestResults.xml" + $script:results = Invoke-Pester -Script "$BuildRoot" -Tag Unit -OutputFile $testResultsFile -PassThru -Show Failed $FailureMessage = '{0} Unit test(s) failed. Aborting build' -f $results.FailedCount - assert ($results.FailedCount -eq 0) $FailureMessage + Assert ($results.FailedCount -eq 0) $FailureMessage } +#EndRegion +#Region - Build Help System $buildMamlParams = @{ Inputs = { Get-ChildItem docs\*.md } - Outputs = "$BuildRoot\temp\en-us\ZertoApiWrapper-help.xml" + Outputs = "{0}\en-us\ZertoApiWrapper-help.xml" -f $moduleOutPath } task BuildMamlHelp CheckPlatyPSInstalled, { @@ -83,28 +123,29 @@ task BuildMamlHelp CheckPlatyPSInstalled, { platyPS\New-ExternalHelp .\docs -Force -OutputPath $buildMamlParams.Outputs } -task UpdateMarkdownHelp CheckPlatyPSInstalled, { - remove-module ZertoApiWrapper -force -ErrorAction SilentlyContinue - Import-Module .\ZertoApiWrapper\ZertoApiWrapper.psm1 -Force - Update-MarkDownHelp -Path docs -AlphabeticParamsOrder +task UpdateMarkdownHelp quickBuild, CheckPlatyPSInstalled, { + ImportBuiltModule + Update-MarkdownHelpModule -Path docs -AlphabeticParamsOrder } +#EndRegion -task CreatePsd1ForRelease CleanTemp, { +#Region - Build Module Files +task CreatePsd1ForRelease CleanPublish, { $functionsToExport = Get-ChildItem -Path 'ZertoApiWrapper\Public\*.ps1' | ForEach-Object { $_.BaseName } - $releaseNotes = "# {0}{1}" -f $version, $(Get-Content .\RELEASENOTES.md -Raw) + $releaseNotes = "Please review the [Release Notes](https://github.com/ZertoPublic/ZertoApiWrapper/releases/tag/{0}) on GitHub." -f $version $ManifestParams = @{ - Path = "$BuildRoot\temp\ZertoApiWrapper.psd1" + Path = "{0}\ZertoApiWrapper.psd1" -f $moduleOutPath RootModule = 'ZertoApiWrapper.psm1' ModuleVersion = $version GUID = '4c0b9e17-141b-4dd5-8549-fb21cccaa325' Author = 'Wes Carroll' CompanyName = 'Zerto' - Copyright = '(c) {0} Wes Carroll. All rights reserved.' -f $(Get-Date -format 'yyyy') - Description = 'PowerShell Core Wrapper Module for Zerto Virtual Manager API' - PowerShellVersion = '6.0.0' - ProjectUri = 'https://github.com/wcarroll/ZertoApiWrapper' - LicenseUri = 'https://github.com/wcarroll/ZertoApiWrapper/blob/master/LICENSE' + Copyright = '(c) {0} Wes Carroll. All rights reserved.' -f $(Get-Date -Format 'yyyy') + Description = 'Windows PowerShell and PowerShell Core API Wrapper Module for Zerto Virtual Manager' + PowerShellVersion = '5.1.0' + ProjectUri = 'https://github.com/ZertoPublic/ZertoApiWrapper' + LicenseUri = 'https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/LICENSE' Tags = @("Zerto", "Automation") FunctionsToExport = $functionsToExport CmdletsToExport = @() @@ -115,67 +156,49 @@ task CreatePsd1ForRelease CleanTemp, { New-ModuleManifest @ManifestParams } -task CleanTemp { - if (-not $(Test-Path "$BuildRoot\temp")) { - New-Item -Path $BuildRoot -Name "temp" -ItemType "Directory" - } - Remove-Item -Recurse -Path "$BuildRoot\temp\*" -} - task CreatePsm1ForRelease CreatePsd1ForRelease, { $emptyLine = "" - $psm1Path = "$BuildRoot\temp\ZertoApiWrapper.psm1" + $psm1Path = "{0}\ZertoApiWrapper.psm1" -f $moduleOutPath $lines = '#------------------------------------------------------------#' - $Public = @( Get-ChildItem -Path $BuildRoot\ZertoApiWrapper\Public\*.ps1 -ErrorAction SilentlyContinue ) - $functionCount = 0 - $exportString = "" - foreach ($file in $Public) { - if ($functionCount -eq 0) { - $functionCount++ - $exportString = "{0}" -f $file.BaseName - } else { - $functionCount++ - $exportString = "{0}, {1}" -f $exportString, $file.BaseName - } - } - $Private = @( Get-ChildItem -Path $BuildRoot\ZertoApiWrapper\Private\*.ps1 -ErrorAction SilentlyContinue ) - Add-Content -Path $psm1Path -Value $lines - Add-Content -Path $psm1Path -Value "#---------------------Private Functions----------------------#" - Add-Content -Path $psm1Path -Value $lines - Add-Content -Path $psm1Path -Value $emptyLine + $Private = @( Get-ChildItem -Path $BuildRoot\ZertoApiWrapper\Private\*.ps1 -ErrorAction Stop ) + $Public = @( Get-ChildItem -Path $BuildRoot\ZertoApiWrapper\Public\*.ps1 -ErrorAction Stop ) + Add-Content -Path $psm1Path -Value $lines -Encoding 'utf8' + Add-Content -Path $psm1Path -Value "#---------------------Private Functions----------------------#" -Encoding 'utf8' + Add-Content -Path $psm1Path -Value $lines -Encoding 'utf8' + Add-Content -Path $psm1Path -Value $emptyLine -Encoding 'utf8' foreach ($file in $private) { - Add-Content -Path $psm1Path -Value $(Get-Content -Path $file.Fullname -Raw) - Add-Content -Path $psm1Path -Value $emptyLine + Add-Content -Path $psm1Path -Value $(Get-Content -Path $file.Fullname -Raw) -Encoding 'utf8' + Add-Content -Path $psm1Path -Value $emptyLine -Encoding 'utf8' } - Add-Content -Path $psm1Path -Value $lines - Add-Content -Path $psm1Path -Value "#----------------------Public Functions----------------------#" - Add-Content -Path $psm1Path -Value $lines - Add-Content -Path $psm1Path -Value $emptyLine + Add-Content -Path $psm1Path -Value $lines -Encoding 'utf8' + Add-Content -Path $psm1Path -Value "#----------------------Public Functions----------------------#" -Encoding 'utf8' + Add-Content -Path $psm1Path -Value $lines -Encoding 'utf8' + Add-Content -Path $psm1Path -Value $emptyLine -Encoding 'utf8' foreach ($file in $public) { - Add-Content -Path $psm1Path -Value $(Get-Content -Path $file.Fullname -Raw) - Add-Content -Path $psm1Path -Value $emptyLine + Add-Content -Path $psm1Path -Value $(Get-Content -Path $file.Fullname -Raw) -Encoding 'utf8' + Add-Content -Path $psm1Path -Value $emptyLine -Encoding 'utf8' } - Add-Content -Path $psm1Path -Value $emptyLine - Add-Content -Path $psm1Path -Value "Export-ModuleMember -Function $exportString" } - -task CreateArtifacts CleanPublish, CreateModule, { - if (-not $(Test-Path "$BuildRoot\publish")) { - New-Item -Path $BuildRoot -Name "publish" -ItemType Directory +#EndRegion + +#Region - Artifacts \ Publish +# Full Build Process - No Publishing +task CreateArtifacts CleanPublish, AnalyzeBuiltFiles, BuiltFileTests, BuildMamlHelp, { + Compress-Archive -Path $moduleOutPath -DestinationPath .\publish\ZertoApiWrapper.zip + $MyMatches = Select-String -Path "$BuildRoot\CHANGELOG.md" "^##\s\[" + $data = Get-Content "$BuildRoot\CHANGELOG.md" + $range = ($MyMatches[0].LineNumber - 1)..($MyMatches[1].LineNumber - 3) + foreach ($i in $range) { + Add-Content -Path "$BuildRoot\publish\ReleaseNotes.md" -Value ($data[$i]).replace("## ", "# ") -Encoding utf8 } - Compress-Archive -Path .\temp\* -DestinationPath .\publish\ZertoApiWrapper.zip - Get-Module -Name ZertoApiWrapper | Remove-Module -Force - Import-Module .\temp\ZertoApiWrapper.psd1 -Force - (Get-Module ZertoApiWrapper).ReleaseNotes | Add-Content .\publish\release-notes.txt - (Get-Module ZertoApiWrapper).Version.ToString() | Add-Content .\publish\release-version.txt } +#EndRegion -task CleanPublish { - if ($(Test-Path "$BuildRoot\publish")) { - Remove-Item -Recurse -Path "$BuildRoot\publish\*" - } +task build CleanPublish, CreatePsm1ForRelease, AnalyzeBuiltFiles, BuiltFileTests, CreateArtifacts +task quickBuild CleanPublish, CreatePsm1ForRelease, AnalyzeBuiltFiles, { + Get-Module -Name ZertoApiWrapper | Remove-Module -Force + ImportBuiltModule } - -task CreateModule CleanTemp, FileTests, AnalyzeBuiltFiles, BuildMamlHelp, { - +task release build, { + Publish-Module -Path $moduleOutPath -NuGetApiKey "1234" -WhatIf } diff --git a/ZertoApiWrapper/Private/Get-Map.ps1 b/ZertoApiWrapper/Private/Get-Map.ps1 new file mode 100644 index 0000000..343a711 --- /dev/null +++ b/ZertoApiWrapper/Private/Get-Map.ps1 @@ -0,0 +1,21 @@ +function Get-Map { + [CmdletBinding()] + [OutputType([Hashtable])] + param( + [Parameter(Mandatory)] + [ValidateNotNullOrEmpty()] + [PSCustomObject]$inputObject, + [Parameter(Mandatory)] + [ValidateNotNullOrEmpty()] + [string]$key, + [Parameter(Mandatory)] + [ValidateNotNullOrEmpty()] + [string]$value + ) + + $returnMap = @{ } + foreach ($item in $inputObject) { + $returnMap[$item.$key] = $item.$value + } + $returnMap +} diff --git a/ZertoApiWrapper/Private/Get-ZertoApiFilter.ps1 b/ZertoApiWrapper/Private/Get-ZertoApiFilter.ps1 index a6400ca..53fbeed 100644 --- a/ZertoApiWrapper/Private/Get-ZertoApiFilter.ps1 +++ b/ZertoApiWrapper/Private/Get-ZertoApiFilter.ps1 @@ -1,22 +1,42 @@ function Get-ZertoApiFilter { [cmdletbinding()] + [Outputtype([String])] param( - [Parameter( Mandatory = $true, + [Parameter( + Mandatory, HelpMessage = "Hashtable that contains filter keys and values" )] + [ValidateNotNullOrEmpty()] [hashtable]$filterTable ) # Define the start of the return string [string]$returnString = "?" - + $commonParameters = @( + "Debug" + "ErrorAction" + "ErrorVariable" + "InformationAction" + "InformationVariable" + "OutVariable" + "OutBuffer" + "PipelineVariable" + "Verbose" + "WarningAction" + "WarningVariable" + "WhatIf" + "Confirm" + ) #Foreach item in the table, process each item foreach ( $key in $filterTable.Keys ) { - #If this is not the first item added to the string, add the ampersand and filter - if ($returnString.Length -gt 1) { - $returnString = "{0}&{1}={2}" -f $returnString, $key, $filterTable[$key] - } else { - #If it is the first item, just add the first item - $returnString = "{0}{1}={2}" -f $returnString, $key, $filterTable[$key] + # If the key is not a common parameter, process it. + if ($key -notin $commonParameters) { + #If this is not the first item added to the string, add the ampersand and filter + if ($returnString.Length -gt 1) { + $returnString = "{0}&{1}={2}" -f $returnString, $key, $filterTable[$key] + } else { + #If it is the first item, just add the first item + $returnString = "{0}{1}={2}" -f $returnString, $key, $filterTable[$key] + } } } # Return the built query String diff --git a/ZertoApiWrapper/Private/Invoke-ZertoRestRequest.ps1 b/ZertoApiWrapper/Private/Invoke-ZertoRestRequest.ps1 deleted file mode 100644 index a52f9a8..0000000 --- a/ZertoApiWrapper/Private/Invoke-ZertoRestRequest.ps1 +++ /dev/null @@ -1,48 +0,0 @@ -function Invoke-ZertoRestRequest { - [cmdletbinding()] - param( - [string]$method = "GET", - [string]$uri, - [string]$apiVersion = "v1", - [string]$body, - [string]$contentType = "application/json", - [System.Management.Automation.PSCredential] - $credential, - [switch]$returnHeaders - ) - $callerErrorActionPreference = $ErrorActionPreference - # If the ZVM server and Port not defined, Stop Call - if ( -not ((Test-Path variable:script:zvmServer) -and (Test-Path variable:script:zvmPort)) ) { - Write-Error -Message "Zerto Connection does not Exist. Please run Connect-ZertoServer first to establish a connection" - break - } - - # If the Headers exist and the Last action was more than 30 minutes ago, Session is Expired - if ( (Test-Path variable:script:zvmHeaders) -and $([datetime]$script:zvmLastAction).addMinutes(30) -lt $(get-date) ) { - Write-Error -Message "Authorization Token has Expired. Please re-authorize to the Zerto Virtual Manager" - break - } else { - - # Build the URI to be submitted - $submittedURI = "https://{0}:{1}/{2}/{3}" -f $script:zvmServer, $script:zvmPort, $apiVersion, $uri - try { - # Set the zvmLastAction time and try to submit the REST Request - $script:zvmLastAction = (get-date).Ticks - $apiRequestResults = Invoke-RestMethod -Uri $submittedURI -Headers $script:zvmHeaders -Method $method -Body $body -ContentType $contentType -Credential $credential -SkipCertificateCheck -ResponseHeadersVariable responseHeaders -TimeoutSec 100 - } catch { - # If an error is encountered, Catch - Write-Error -ErrorRecord $_ -ErrorAction $callerErrorActionPreference - } - - # If the calling function does not need the headers (Default Action) return the results of the API Call - if (-not $returnHeaders) { - return $apiRequestResults - } else { - #If Headers are required, build a PS Custom Object with the Results and the Headers - $apiRequestAndHeaderResults = New-Object -TypeName psobject - $apiRequestAndHeaderResults | Add-Member -MemberType NoteProperty -Name "apiRequestResults" -Value $apiRequestResults - $apiRequestAndHeaderResults | Add-Member -MemberType NoteProperty -Name "Headers" -Value $responseHeaders - return $apiRequestAndHeaderResults - } - } -} diff --git a/ZertoApiWrapper/Public/Add-ZertoPeerSite.ps1 b/ZertoApiWrapper/Public/Add-ZertoPeerSite.ps1 index ecf104e..6e1a050 100644 --- a/ZertoApiWrapper/Public/Add-ZertoPeerSite.ps1 +++ b/ZertoApiWrapper/Public/Add-ZertoPeerSite.ps1 @@ -3,24 +3,33 @@ function Add-ZertoPeerSite { [cmdletbinding( SupportsShouldProcess = $true )] param( [parameter( - Mandatory = $true, + Mandatory, HelpMessage = "Target Hostname or IP address to pair the localsite to." )] - [ValidateScript( {$_ -match [IPAddress]$_ } )] + [ValidateNotNullOrEmpty()] [string]$targetHost, [Parameter( HelpMessage = "Target communication port. Default is 9081" )] [ValidateRange(1024, 65535)] - [int]$targetPort = 9081 + [int]$targetPort = 9081, + [Parameter( + HelpMessage = "The generated token from the destination site. Note: This is only supported when both sites support pairing authentication. This was implemented to support ZVR 7.5 and later." + )] + [ValidateNotNullOrEmpty()] + [string]$token ) begin { - $baseUri = "peersites" - $body = @{"HostName" = $targetHost; "Port" = $targetPort} } process { + $baseUri = "peersites" + if ($PSBoundParameters.Keys.Contains("token")) { + $body = @{ "HostName" = $targetHost; "Port" = $targetPort; "Token" = $token } + } else { + $body = @{ "HostName" = $targetHost; "Port" = $targetPort } + } if ($PSCmdlet.ShouldProcess("Pairing with Site $targetHost")) { Invoke-ZertoRestRequest -uri $baseUri -body $($body | ConvertTo-Json) -method "POST" } diff --git a/ZertoApiWrapper/Public/Add-ZertoVpgVm.ps1 b/ZertoApiWrapper/Public/Add-ZertoVpgVm.ps1 new file mode 100644 index 0000000..d504acf --- /dev/null +++ b/ZertoApiWrapper/Public/Add-ZertoVpgVm.ps1 @@ -0,0 +1,104 @@ +<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #> +function Add-ZertoVpgVm { + [CmdletBinding(SupportsShouldProcess, DefaultParameterSetName = "VpgName")] + param ( + [Parameter( + Mandatory, + HelpMessage = "Vpg Settings Identifier", + ValueFromPipeline, + ValueFromPipelineByPropertyName, + ValueFromRemainingArguments, + ParameterSetName = "VpgSettingsIdentifier" + )] + [ValidateNotNullOrEmpty()] + [Alias("sid", "settingsIdentifier", "vpgSettingsId")] + [String]$vpgSettingsIdentifier, + [Parameter( + Mandatory, + HelpMessage = "Target VPG Name to Add the VM", + ParameterSetName = "VpgName" + )] + [ValidateNotNullOrEmpty()] + [String]$VpgName, + [Parameter( + Mandatory, + HelpMessage = "Name of VM(s) to add to the VPG" + )] + [ValidateNotNullOrEmpty()] + [String[]]$Vm + ) + + begin { + + } + + process { + if ($PSCmdlet.ParameterSetName -eq "VpgName") { + $VpgIdentifier = Get-ZertoVpg -name $VpgName | Select-Object -ExpandProperty VpgIdentifier + if (-not $VpgIdentifier) { + Write-Error "Unable to find Vpg with name $VpgName. Please check your parameters and try again." -ErrorAction Stop + } else { + $vpgSettingsIdentifier = New-ZertoVpgSettingsIdentifier -vpgIdentifier $VpgIdentifier + } + } + $baseUrl = "vpgsettings/{0}/vms" -f $vpgSettingsIdentifier + $baseSettings = Get-ZertoVpgSetting -vpgSettingsIdentifier $vpgSettingsIdentifier + if ($PSCmdlet.ParameterSetName -eq "VpgSettingsIdentifier") { + $VpgName = $baseSettings.Basic.Name + } + $unprotectedVms = Get-ZertoUnprotectedVm + $protectedVms = Get-ZertoProtectedVm + $vmMap = Get-Map -inputObject $unprotectedVms -key VmName -value VmIdentifier + $vmMap = $vmMap + (Get-Map -inputObject $protectedVms -key VmName -value VmIdentifier) + # Create array of VM identifiers + $vmIdentifiers = foreach ($machine in ($Vm | Select-Object -Unique)) { + if ($vmMap[$machine] -notin $baseSettings.Vms.vmIdentifier ) { + # If the VM is unprotected, get the identifier + $vmIdentifier = $unprotectedVms | Where-Object { $_.vmName -like $machine } | Select-Object -ExpandProperty vmIdentifier + # If the VM is not unprotected, check the protected VMs + if ( -not $vmIdentifier) { + # Get all identifiers to test if the VM is eligible to be a member of an additional VPG + $results = $protectedVms | Where-Object { $_.VmName -like $machine } | Select-Object -ExpandProperty vmIdentifier + $recoverySiteIdentifiers = $protectedVms | Where-Object { $_.VmName -like $machine } | Select-Object -ExpandProperty RecoverySite | Select-Object -ExpandProperty identifier + # If VM is currently a member of 3 VPGs, skip it. If it cannot be found, skip it. Otherwise, set the identifier + if ($baseSettings.basic.RecoverySiteIdentifier -in $recoverySiteIdentifiers) { + Write-Warning "$machine is already replicating to target site. It cannot be added to an additional VPG replicating to that site. Please check your configurations and try again. Skipping $machine" + continue + } elseif ($results.count -eq 3) { + Write-Warning "$machine is already a part of 3 VPGs and cannot be part of an additional VPG. Skipping $machine" + continue + } elseif ($results.count -eq 0) { + Write-Warning "$machine not found. Skipping $machine" + continue + } else { + $vmIdentifier = $results | Select-Object -First 1 + } + } + # Create a custom object to store the information to easily convert to JSON. Return to vmIdentifiers array. + $vmIdentifier + } else { + Write-Warning "$machine is already a member of this VPG Settings object. It will not be added again. Skipping $machine" + continue + } + } + if ($vmIdentifiers.Count -gt 0 -and $PSCmdlet.ShouldProcess($VmIdentifiers, "Adding VM(s): $Vm to Vpg $VpgName")) { + foreach ($id in $VmIdentifiers) { + # Build the Body + $Body = @{VmIdentifier = $id } + # Submit the request. Out to Null to prevent line returns while running. + $null = Invoke-ZertoRestRequest -uri $baseUrl -method POST -body ($Body | ConvertTo-Json -Depth 10) + } + + $vpgSettingsIdentifier + } else { + Write-Warning "No VMs found to add. Please check your parameters and try again." + if ($PSCmdlet.ParameterSetName -eq "VpgName") { + Remove-ZertoVpgSettingsIdentifier -vpgSettingsIdentifier $vpgSettingsIdentifier + } + } + } + + end { + + } +} diff --git a/ZertoApiWrapper/Public/Checkpoint-ZertoVpg.ps1 b/ZertoApiWrapper/Public/Checkpoint-ZertoVpg.ps1 index e8d94b7..65dfbfa 100644 --- a/ZertoApiWrapper/Public/Checkpoint-ZertoVpg.ps1 +++ b/ZertoApiWrapper/Public/Checkpoint-ZertoVpg.ps1 @@ -3,13 +3,15 @@ function Checkpoint-ZertoVpg { [cmdletbinding()] param( [Parameter( - Mandatory = $true, - HelpMessage = "Name of the VPG to tag." + Mandatory, + HelpMessage = "Name of the VPG to tag.", + ValueFromPipeline = $true, + ValueFromPipelineByPropertyName = $true )] [ValidateNotNullOrEmpty()] - [string]$vpgName, + [string[]]$vpgName, [Parameter( - Mandatory = $true, + Mandatory, HelpMessage = "Text to tag the checkpoint with." )] [ValidateNotNullOrEmpty()] @@ -18,16 +20,18 @@ function Checkpoint-ZertoVpg { begin { $baseUri = "vpgs" - $vpgIdentifier = $(get-zertovpg -name $vpgName).vpgIdentifier - $body = @{"checkpointName" = $checkpointName} } process { - if ($vpgIdentifier) { - $uri = "{0}/{1}/Checkpoints" -f $baseUri, $vpgIdentifier - Invoke-ZertoRestRequest -uri $uri -body $($body | ConvertTo-Json) -method "POST" - } else { - Write-Output "Cannot find VPG named $vpgName. Please check the name and try again." + foreach ($name in $vpgName) { + $vpgIdentifier = $(get-zertovpg -name $name).vpgIdentifier + if ($vpgIdentifier) { + $uri = "{0}/{1}/Checkpoints" -f $baseUri, $vpgIdentifier + $body = @{"checkpointName" = $checkpointName } + Invoke-ZertoRestRequest -uri $uri -body $($body | ConvertTo-Json) -method "POST" + } else { + Write-Output "Cannot find VPG named $name. Please check the name and try again." + } } } diff --git a/ZertoApiWrapper/Public/Connect-ZertoAnalytics.ps1 b/ZertoApiWrapper/Public/Connect-ZertoAnalytics.ps1 new file mode 100644 index 0000000..8bbd20a --- /dev/null +++ b/ZertoApiWrapper/Public/Connect-ZertoAnalytics.ps1 @@ -0,0 +1,20 @@ +<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #> +function Connect-ZertoAnalytics { + [cmdletbinding()] + param( + [Parameter( + Mandatory, + HelpMessage = "PSCredential Object containing username and password authorized for the Zerto Analytics site", + Position = 0 + )] + [System.Management.Automation.PSCredential]$credential + ) + + $uri = "auth/token" + Set-Variable -Name zaHeaders -Scope Script -Value @{"Accept" = "application/json" } + Set-Variable -Name zaLastActionTime -Scope Script -Value $(Get-date).Ticks + $body = @{"username" = $credential.UserName; "password" = $credential.GetNetworkCredential().password } + $result = Invoke-ZARestRequest -Uri $uri -body $($body | ConvertTo-Json) -Method POST + $Script:zaHeaders["Authorization"] = "Bearer $($result.Token)" + $Script:zaHeaders +} diff --git a/ZertoApiWrapper/Public/Connect-ZertoServer.ps1 b/ZertoApiWrapper/Public/Connect-ZertoServer.ps1 index 5c7b3b0..237f845 100644 --- a/ZertoApiWrapper/Public/Connect-ZertoServer.ps1 +++ b/ZertoApiWrapper/Public/Connect-ZertoServer.ps1 @@ -4,12 +4,19 @@ function Connect-ZertoServer { [OutputType([hashtable])] param( [Parameter( - Mandatory = $true, - HelpMessage = "IP address or FQDN of your Zerto Management Server" + Mandatory, + HelpMessage = "IP address or FQDN of your Zerto Management Server", + Position = 0 )] [ValidateNotNullOrEmpty()] [Alias("server", "zvm")] [string]$zertoServer, + [Parameter( + Mandatory, + HelpMessage = "Valid credentials to connect to the Zerto Management Server", + Position = 1 + )] + [System.Management.Automation.PSCredential]$credential, [Parameter( HelpMessage = "Zerto Virtual Manager management port. Default value is 9669." )] @@ -18,11 +25,14 @@ function Connect-ZertoServer { [Alias("port")] [string]$zertoPort = "9669", [Parameter( - Mandatory = $true, - HelpMessage = "Valid credentials to connect to the Zerto Management Server" + HelpMessage = "Use this switch to indicate that you would like the module to take care of auto re-authorization and reconnection to the ZVM should the token expire. This option will cache your PSCredential object to be reused" + )] + [switch]$AutoReconnect, + [Parameter( + HelpMessage = "Use this switch to return the headers to a specified variable or to the default output." )] - [System.Management.Automation.PSCredential]$credential, [switch]$returnHeaders + ) begin { @@ -32,9 +42,16 @@ function Connect-ZertoServer { Set-Variable -Name zvmServer -Scope Script -Value $zertoServer Set-Variable -Name zvmPort -Scope Script -Value $zertoPort # Set zvmLastAction Variable to keep track when the API token expires - Set-Variable -Name zvmLastAction -Scope Script -Value $(get-date).Ticks + Set-Variable -Name zvmLastAction -Scope Script -Value $(Get-Date).Ticks # Set / Clear the zvmHeaders to clear any existing token - Set-Variable -Name zvmHeaders -Scope Script -Value $null + Set-Variable -Name zvmHeaders -Scope Script -Value @{ + "Accept" = "application/json" + "zerto-triggered-by" = "PowershellWes" + } + Set-Variable -Name Reconnect -Scope Script -Value $AutoReconnect.IsPresent + if ($Script:Reconnect) { + Set-Variable -Name CachedCredential -Scope Script -Value $credential + } } process { @@ -44,14 +61,11 @@ function Connect-ZertoServer { end { # Build Headers Hashtable with Authorization Token - $zertoAuthorizationHeaders = @{"x-zerto-session" = $results.Headers['x-zerto-session'][0].ToString(); "Accept" = "application/json"} - # Set common Script Scope Variables to be used other functions (Headers and Local Site Info) - Set-Variable -Name zvmHeaders -Scope Script -Value $zertoAuthorizationHeaders - Set-Variable -Name zvmLocalInfo -Scope Script -Value (Get-ZertoLocalSite) - + $Script:zvmHeaders['x-zerto-session'] = $results.Headers['x-zerto-session'][0].ToString() + # Have the option to return the headers to a variable if ($returnHeaders) { - return $zertoAuthorizationHeaders + return $Script:zvmHeaders } } } diff --git a/ZertoApiWrapper/Public/Copy-ZertoVpg.ps1 b/ZertoApiWrapper/Public/Copy-ZertoVpg.ps1 new file mode 100644 index 0000000..de4f2bc --- /dev/null +++ b/ZertoApiWrapper/Public/Copy-ZertoVpg.ps1 @@ -0,0 +1,59 @@ +<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #> +function Copy-ZertoVpg { + [CmdletBinding(SupportsShouldProcess)] + param ( + # VPG Name to Clone + [Parameter(Mandatory, + HelpMessage = "Name of the VPG to clone")] + [ValidateNotNullOrEmpty()] + [String]$SourceVpgName, + # New VPG Name + [Parameter(Mandatory, + HelpMessage = "Name to assign the newly created VPG")] + [ValidateNotNullOrEmpty()] + [String]$NewVpgName, # Name of VMs to add to the VPG + [Parameter(Mandatory, + HelpMessage = "Name(s) of the Virtual Machine(s) to add to the VPG")] + [ValidateNotNullOrEmpty()] + [String[]]$VMs + ) + + begin { + + } + + process { + $VpgIdToCopy = @{ VpgIdentifier = (Get-ZertoVpg -vpgName $SourceVpgName).vpgIdentifier } + if ( $null -eq $VpgIdToCopy.VpgIdentifier ) { + Throw "Unable to find a VPG with the name: $SourceVpgName. Please check the name and try again." + } + $BaseUri = "vpgSettings/copyVpgSettings" + $VmsMap = Get-Map -InputObject (Get-ZertoUnprotectedVm) -Key 'VmName' -Value 'VmIdentifier' + $VmsMap += Get-Map -InputObject (Get-ZertoProtectedVm) -Key 'VmName' -Value 'VmIdentifier' + $VMsToAdd = foreach ($VM in $VMs) { + if ($VmsMap.Keys -contains $VM) { + [PSCustomObject]@{ + VmIdentifier = $VmsMap[$VM] + } + } else { + Write-Warning -Message "Unable to find VM with Name $VM. Skipping." + } + } + if ($PSCmdlet.ShouldProcess("$VMsToAdd", "Copying $SourceVpgName to $NewVpgName with Settings")) { + $NewVpgId = Invoke-ZertoRestRequest -Uri $BaseUri -Body ($VpgIdToCopy | ConvertTo-Json) -Method "POST" + $Uri = "{0}/{1}/vms" -f "vpgSettings", $NewVpgId + foreach ($VM in $VMsToAdd) { + $null = Invoke-ZertoRestRequest -Uri $Uri -Body ($VM | ConvertTo-Json) -Method "POST" -ErrorAction Stop + } + $Uri = "vpgSettings/{0}" -f $NewVpgId + $CurrentSettings = Invoke-ZertoRestRequest -Uri $Uri + $CurrentSettings.Basic.Name = $NewVpgName + $Null = Invoke-ZertoRestRequest -Uri $Uri -Method "Put" -Body $($CurrentSettings | ConvertTo-Json -Depth 20) + Save-ZertoVpgSetting -vpgSettingsIdentifier $NewVpgId + } + } + + end { + + } +} diff --git a/ZertoApiWrapper/Public/Disconnect-ZertoServer.ps1 b/ZertoApiWrapper/Public/Disconnect-ZertoServer.ps1 index 4559701..080ec50 100644 --- a/ZertoApiWrapper/Public/Disconnect-ZertoServer.ps1 +++ b/ZertoApiWrapper/Public/Disconnect-ZertoServer.ps1 @@ -5,12 +5,11 @@ function Disconnect-ZertoServer { $uri = "session" # Delete API Authorization - Invoke-ZertoRestRequest -uri $uri -method DELETE + $null = Invoke-ZertoRestRequest -uri $uri -method DELETE # Remove all variables used Remove-Variable -Name zvmServer -Scope Script Remove-Variable -Name zvmPort -Scope Script Remove-Variable -Name zvmLastAction -Scope Script Remove-Variable -Name zvmHeaders -Scope Script - Remove-Variable -Name zvmLocalInfo -Scope Script } diff --git a/ZertoApiWrapper/Public/Edit-ZertoVra.ps1 b/ZertoApiWrapper/Public/Edit-ZertoVra.ps1 index acf1693..855f0d4 100644 --- a/ZertoApiWrapper/Public/Edit-ZertoVra.ps1 +++ b/ZertoApiWrapper/Public/Edit-ZertoVra.ps1 @@ -3,7 +3,7 @@ function Edit-ZertoVra { [cmdletbinding( SupportsShouldProcess = $true )] param( [Parameter( - Mandatory = $true, + Mandatory, HelpMessage = "Identifier of the VRA to be updated." )] [ValidateNotNullOrEmpty()] @@ -18,20 +18,26 @@ function Edit-ZertoVra { ParameterSetName = "StaticIp", HelpMessage = "Static IP address to assign to the VRA." )] - [ValidateScript( {$_ -match [IPAddress]$_ })] + [ValidateScript( { $_ -match [IPAddress]$_ })] [string]$vraIpAddress, [Parameter( ParameterSetName = "StaticIp", HelpMessage = "Default gateway to assign to the VRA" )] - [ValidateScript( {$_ -match [IPAddress]$_ })] + [ValidateScript( { $_ -match [IPAddress]$_ })] [string]$defaultGateway, [Parameter( ParameterSetName = "StaticIp", HelpMessage = "Subnetmask to be assigned to the VRA" )] - [ValidateScript( {$_ -match [IPAddress]$_ })] - [string]$subnetMask + [ValidateScript( { $_ -match [IPAddress]$_ })] + [string]$subnetMask, + [Parameter( + HelpMessage = "Updated ESXi host root password." + )] + [ValidateNotNullOrEmpty()] + [securestring]$HostRootPassword + ) begin { @@ -39,14 +45,14 @@ function Edit-ZertoVra { # Get the current VRA information for use if an updated parameter is not supplied $vra = Get-ZertoVra -vraIdentifier $vraIdentifier if ( -not $vra ) { - Write-Error "VRA with Identifier: $vraIdentifier could not be found. Please check the ID and try again." + Throw "VRA with Identifier: $vraIdentifier could not be found. Please check the ID and try again." } } process { # Create ordered hashtables to be converted later to JSON. - $vraUpdate = [ordered]@{} - $vraNetwork = [ordered]@{} + $vraUpdate = [ordered]@{ } + $vraNetwork = [ordered]@{ } # If a new group name is specified, update. if ( $PSBoundParameters.ContainsKey('GroupName')) { $vraUpdate['GroupName'] = $groupName @@ -77,8 +83,14 @@ function Edit-ZertoVra { $vraNetwork['VraIPConfigurationTypeApi'] = "Dhcp" $vraUpdate['VraNetworkDataApi'] = $vraNetwork } + if ($PSBoundParameters.ContainsKey('HostRootPassword')) { + $HostRootCredential = [pscredential]::New('root', $HostRootPassword) + $vraUpdate['UsePublicKeyInsteadOfCredentials'] = $false + $vraUpdate['HostRootPassword'] = $HostRootCredential.GetNetworkCredential().Password + } + # -WhatIf processing and submit! - if ($PSCmdlet.ShouldProcess( "Updating " + $vra.vraName + " with these settings: $($vraUpdate | convertTo-Json)")) { + if ($PSCmdlet.ShouldProcess( $vra.vraName )) { Invoke-ZertoRestRequest -uri $baseUri -body $($vraUpdate | ConvertTo-Json) -method "PUT" } } @@ -87,4 +99,4 @@ function Edit-ZertoVra { # Nothing to Do } } -#TODO: Refactor \ No newline at end of file +#TODO: Refactor diff --git a/ZertoApiWrapper/Public/Export-ZertoVmNicSetting.ps1 b/ZertoApiWrapper/Public/Export-ZertoVmNicSetting.ps1 new file mode 100644 index 0000000..110b125 --- /dev/null +++ b/ZertoApiWrapper/Public/Export-ZertoVmNicSetting.ps1 @@ -0,0 +1,83 @@ +<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #> +function Export-ZertoVmNicSetting { + [CmdletBinding()] + param ( + # Vpg(s) to export. If no VPG was named, all data will be exported. + [Parameter( + Helpmessage = "VPG(s) to export" + )] + [ValidateNotNullOrEmpty()] + [string[]] + $VpgName, + # Output file information + [Parameter( + Helpmessage = "File to export the data to. This MUST be a CSV. If a CSV filename is not specified, the file will be forced into a CSV", + Mandatory + )] + [ValidateNotNullOrEmpty()] + [string] + $OutputFile + ) + + begin { + } + + process { + if (($OutputFile.Split('.')[-1]) -ne 'csv') { + $OutputFile += '.csv' + } + if ( "VpgName" -in $PSBoundParameters.Keys ) { + $vpgs = Get-ZertoVpg | Where-Object { $_.VpgName -in $VpgName } + foreach ($group in $VpgName) { + if ($group -notin $vpgs.VpgName) { + Write-Error "$group VPG not found. Skipping." -ErrorAction Continue + } + } + } else { + $vpgs = Get-ZertoVpg + } + $nicSettings = foreach ($group in $vpgs) { + $protectedVms = Get-ZertoProtectedVm -vpgName ($group.vpgname) + $vmMap = Get-Map -InputObject $protectedVms -key "vmIdentifier" -value "vmName" + $settingsId = New-ZertoVpgSettingsIdentifier -vpgIdentifier $group.vpgIdentifier + $vmSettings = Get-ZertoVpgSetting -vpgSettingsIdentifier $settingsId -vms + $networks = Get-ZertoVirtualizationSite -siteIdentifier $group.RecoverySite.identifier -networks + $null = Remove-ZertoVpgSettingsIdentifier -vpgSettingsIdentifier $settingsId + $networkMap = Get-Map -InputObject $networks -key "NetworkIdentifier" -value "VirtualizationNetworkName" + foreach ($vm in $vmSettings) { + if ($vm.nics.count -gt 0) { + foreach ($nic in $vm.nics) { + $nicInfo = [PSCustomObject]@{ + VPGName = $group.VPGName + VMName = $vmMap[$vm.vmIdentifier] + NicIdentifier = $nic.NicIdentifier + LiveNetwork = $networkMap[$nic.failover.Hypervisor.NetworkIdentifier] + LiveShouldReplaceMac = $nic.failover.Hypervisor.ShouldReplaceMacAddress + LiveIsDHCP = $nic.failover.Hypervisor.IpConfig.IsDhcp + LiveIpAddress = $nic.failover.Hypervisor.IpConfig.StaticIp + LiveIpSubnetMask = $nic.failover.Hypervisor.IpConfig.SubnetMask + LiveIpDefaultGateway = $nic.failover.Hypervisor.IpConfig.Gateway + LivePrimaryDns = $nic.failover.Hypervisor.IpConfig.PrimaryDns + LiveSecondayDns = $nic.failover.Hypervisor.IpConfig.SecondaryDns + LiveDnsSuffix = $nic.failover.Hypervisor.DnsSuffix + TestNetwork = $networkMap[$nic.failoverTest.Hypervisor.NetworkIdentifier] + TestShouldReplaceMac = $nic.failoverTest.Hypervisor.ShouldReplaceMacAddress + TestIsDHCP = $nic.failoverTest.Hypervisor.IpConfig.IsDhcp + TestIpAddress = $nic.failoverTest.Hypervisor.IpConfig.StaticIp + TestIpSubnetMask = $nic.failoverTest.Hypervisor.IpConfig.SubnetMask + TestIpDefaultGateway = $nic.failoverTest.Hypervisor.IpConfig.Gateway + TestPrimaryDns = $nic.failoverTest.Hypervisor.IpConfig.PrimaryDns + TestSecondayDns = $nic.failoverTest.Hypervisor.IpConfig.SecondaryDns + TestDnsSuffix = $nic.failoverTest.Hypervisor.DnsSuffix + } + $nicInfo + } + } + } + } + $nicSettings | Export-Csv -Path $OutputFile -NoTypeInformation + } + + end { + } +} diff --git a/ZertoApiWrapper/Public/Export-ZertoVpg.ps1 b/ZertoApiWrapper/Public/Export-ZertoVpg.ps1 index 3f5efb8..2d71999 100644 --- a/ZertoApiWrapper/Public/Export-ZertoVpg.ps1 +++ b/ZertoApiWrapper/Public/Export-ZertoVpg.ps1 @@ -4,7 +4,7 @@ function Export-ZertoVpg { param( [Parameter( HelpMessage = "Location where to dump the resulting JSON files containing the VPG Settings", - Mandatory = $true + Mandatory )] [ValidateNotNullOrEmpty()] [Alias("outputFolder")] @@ -12,7 +12,7 @@ function Export-ZertoVpg { [parameter( HelpMessage = "Name(s) of the VPG(s) to be exported", ParameterSetName = "namedVpgs", - Mandatory = $true + Mandatory )] [ValidateNotNullOrEmpty()] [string[]]$vpgName, @@ -21,7 +21,7 @@ function Export-ZertoVpg { ParameterSetName = "allVpgs", valuefrompipeline = $true, ValueFromPipelineByPropertyName = $true, - Mandatory = $true + Mandatory )] [switch]$allVpgs ) @@ -38,6 +38,7 @@ function Export-ZertoVpg { $vpgSettings = Get-ZertoVpgSetting -vpgSettingsIdentifier $vpgSettingsIdentifier $filePath = "{0}\{1}.json" -f $outputPath, $name $vpgSettings | Convertto-Json -depth 10 | Out-File -FilePath $filePath + $null = Remove-ZertoVpgSettingsIdentifier -vpgSettingsIdentifier $vpgSettingsIdentifier } } diff --git a/ZertoApiWrapper/Public/Get-ZAAlert.ps1 b/ZertoApiWrapper/Public/Get-ZAAlert.ps1 new file mode 100644 index 0000000..e173b34 --- /dev/null +++ b/ZertoApiWrapper/Public/Get-ZAAlert.ps1 @@ -0,0 +1,39 @@ +<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #> +function Get-ZAAlert { + [cmdletbinding( DefaultParameterSetName = "zOrg")] + param( + [Parameter( + HelpMessage = "The ZORG identifier by which to filter the alert list. If the ZORG identifier is omitted, a list of all the alerts is retrieved.", + ParameterSetName = "zOrg" + )] + [ValidateNotNullOrEmpty()] + [string]$zOrgIdentifier, + [Parameter( + HelpMessage = "The maximum number of alerts to return.", + ParameterSetName = "zOrg" + )] + [ValidateRange(1, 1000000)] + [int]$limitTo, + [Parameter( + HelpMessage = "The alert Idnetifier", + ParameterSetName = "alertId", + Mandatory + )] + [ValidateNotNullOrEmpty()] + [string]$alertIdentifier + ) + $uri = "monitoring/alerts" + switch ($PSCmdlet.ParameterSetName) { + zOrg { + if ( $PSBoundParameters.Keys.Count -gt 0 ) { + $filterString = Get-ZertoApiFilter -filterTable $PSBoundParameters + $uri = "{0}{1}" -f $uri, $filterString + } + } + + alertId { + $uri = "{0}/{1}" -f $uri, $alertIdentifier + } + } + Invoke-ZARestRequest -uri $uri +} diff --git a/ZertoApiWrapper/Public/Get-ZADatastore.ps1 b/ZertoApiWrapper/Public/Get-ZADatastore.ps1 new file mode 100644 index 0000000..315e26c --- /dev/null +++ b/ZertoApiWrapper/Public/Get-ZADatastore.ps1 @@ -0,0 +1,39 @@ +<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #> +function Get-ZADatastore { + [CmdletBinding(DefaultParameterSetName = "AllInfo")] + param ( + [Parameter( + HelpMessage = "The site identifier. The site identifier is mandatory. Omit the datastore and datastore cluster identifiers to view site level storage information.", + Mandatory, + ParameterSetName = "AllInfo" + )] + [Parameter( + Mandatory, + ParameterSetName = "cluster" + )] + [Parameter( + Mandatory, + ParameterSetName = "datastore" + )] + [ValidateNotNullOrEmpty()] + [string]$siteIdentifier, + [Parameter( + HelpMessage = "The datastore cluster identifier. Gets a list of datastores in the cluster.", + ParameterSetName = "cluster", + Mandatory + )] + [ValidateNotNullOrEmpty()] + [string]$clusterIdentifier, + [Parameter( + HelpMessage = "The datastore identifer. Gets the datastore info.", + ParameterSetName = "datastore", + Mandatory + )] + [ValidateNotNullOrEmpty()] + [string]$datastoreIdentifier + + ) + $filter = Get-ZertoApiFilter -filterTable $PSBoundParameters + $uri = "monitoring/datastores{0}" -f $filter + Invoke-ZARestRequest -uri $uri +} diff --git a/ZertoApiWrapper/Public/Get-ZAEvent.ps1 b/ZertoApiWrapper/Public/Get-ZAEvent.ps1 new file mode 100644 index 0000000..beb9ca9 --- /dev/null +++ b/ZertoApiWrapper/Public/Get-ZAEvent.ps1 @@ -0,0 +1,39 @@ +<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #> +function Get-ZAEvent { + [cmdletbinding()] + param( + [Parameter( + HelpMessage = "The ZORG identifier by which to filter the user's events. If the ZORG identifier is omitted, events is retrieved." + )] + [ValidateNotNullOrEmpty()] + [string]$zOrgIdentifier, + [Parameter( + HelpMessage = "The event category (events/alertsHistory). Default displays the list of all." + )] + [ValidateSet("events", "alertsHistory")] + [string]$category, + [Parameter( + HelpMessage = "The maximum number of events to return." + )] + [ValidateRange(1, 1000000)] + [int]$limitTo, + [Parameter( + HelpMessage = "The earliest timestamp of an event to return, in RFC 3339 standard ('1970-01-01T00:00:00Z'). Default is one year ago." + )] + [ValidateNotNullOrEmpty()] + [string]$startDate, + [Parameter( + HelpMessage = "The latest timestamp of an event to return, in RFC 3339 standard ('1970-01-01T00:00:00Z'). Default is the present time." + )] + [ValidateNotNullOrEmpty()] + [string]$endDate + ) + $uri = "monitoring/events" + + if ( $PSBoundParameters.Keys.Count -gt 0 ) { + $filterString = Get-ZertoApiFilter -filterTable $PSBoundParameters + $uri = "{0}{1}" -f $uri, $filterString + } + + Invoke-ZARestRequest -uri $uri +} diff --git a/ZertoApiWrapper/Public/Get-ZAJournalAverageHistory.ps1 b/ZertoApiWrapper/Public/Get-ZAJournalAverageHistory.ps1 new file mode 100644 index 0000000..4dc0ca2 --- /dev/null +++ b/ZertoApiWrapper/Public/Get-ZAJournalAverageHistory.ps1 @@ -0,0 +1,31 @@ +<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #> +function Get-ZAJournalAverageHistory { + [CmdletBinding()] + param ( + [Parameter( + HelpMessage = "The identifier of the VPG.", + Mandatory + )] + [ValidateNotNullOrEmpty()] + [string]$vpgIdentifier, + [Parameter( + HelpMessage = "The starting date of the report, in RFC 3339 standard ('1970-01-01T00:00:00Z'). If only the end date is added, the start date by default will be the end date minus 7 days." + )] + [ValidateNotNullOrEmpty()] + [string]$startDate, + [Parameter( + HelpMessage = "The end date of the report, in RFC 3339 standard ('1970-01-01T00:00:00Z'). The default is the current time." + )] + [ValidateNotNullOrEmpty()] + [string]$endDate, + [Parameter( + HelpMessage = "The interval selected within the duration of the report. The interval can be per hour, for up to 15 days’ time frame or per day, for between 15 to 30 days' time frame. Submit value in Seconds" + )] + [ValidateRange(60, 2678400)] + [Int32]$interval + ) + + $filter = Get-ZertoApiFilter -filtertable $PSBoundParameters + $uri = "reports/journal-history-average{0}" -f $filter + Invoke-ZARestRequest -uri $uri +} diff --git a/ZertoApiWrapper/Public/Get-ZAJournalAverageSize.ps1 b/ZertoApiWrapper/Public/Get-ZAJournalAverageSize.ps1 new file mode 100644 index 0000000..26f7955 --- /dev/null +++ b/ZertoApiWrapper/Public/Get-ZAJournalAverageSize.ps1 @@ -0,0 +1,31 @@ +<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #> +function Get-ZAJournalAverageSize { + [CmdletBinding()] + param ( + [Parameter( + HelpMessage = "The identifier of the VPG.", + Mandatory + )] + [ValidateNotNullOrEmpty()] + [string]$vpgIdentifier, + [Parameter( + HelpMessage = "The starting date of the report, in RFC 3339 standard ('1970-01-01T00:00:00Z'). If only the end date is added, the start date by default will be the end date minus 7 days." + )] + [ValidateNotNullOrEmpty()] + [string]$startDate, + [Parameter( + HelpMessage = "The end date of the report, in RFC 3339 standard ('1970-01-01T00:00:00Z'). The default is the current time." + )] + [ValidateNotNullOrEmpty()] + [string]$endDate, + [Parameter( + HelpMessage = "The interval selected within the duration of the report. The interval can be per hour, for up to 15 days’ time frame or per day, for between 15 to 30 days' time frame. Submit value in Seconds" + )] + [ValidateRange(60, 2678400)] + [Int32]$interval + ) + + $filter = Get-ZertoApiFilter -filtertable $PSBoundParameters + $uri = "reports/journal-size-average{0}" -f $filter + Invoke-ZARestRequest -uri $uri +} diff --git a/ZertoApiWrapper/Public/Get-ZAJournalBreach.ps1 b/ZertoApiWrapper/Public/Get-ZAJournalBreach.ps1 new file mode 100644 index 0000000..d4afbf6 --- /dev/null +++ b/ZertoApiWrapper/Public/Get-ZAJournalBreach.ps1 @@ -0,0 +1,26 @@ +<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #> +function Get-ZAJournalBreach { + [CmdletBinding()] + param ( + [Parameter( + HelpMessage = "The identifier of the VPG.", + Mandatory + )] + [ValidateNotNullOrEmpty()] + [string]$vpgIdentifier, + [Parameter( + HelpMessage = "The starting date of the report, in RFC 3339 standard ('1970-01-01T00:00:00Z'). If only the end date is added, the start date by default will be the end date minus 7 days." + )] + [ValidateNotNullOrEmpty()] + [string]$startDate, + [Parameter( + HelpMessage = "The end date of the report, in RFC 3339 standard ('1970-01-01T00:00:00Z'). The default is the current time." + )] + [ValidateNotNullOrEmpty()] + [string]$endDate + ) + + $filter = Get-ZertoApiFilter -filtertable $PSBoundParameters + $uri = "reports/journal-breach{0}" -f $filter + Invoke-ZARestRequest -uri $uri +} diff --git a/ZertoApiWrapper/Public/Get-ZAJournalHistoryStat.ps1 b/ZertoApiWrapper/Public/Get-ZAJournalHistoryStat.ps1 new file mode 100644 index 0000000..d973aea --- /dev/null +++ b/ZertoApiWrapper/Public/Get-ZAJournalHistoryStat.ps1 @@ -0,0 +1,26 @@ +<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #> +function Get-ZAJournalHistoryStat { + [CmdletBinding()] + param ( + [Parameter( + HelpMessage = "The identifier of the VPG.", + Mandatory + )] + [ValidateNotNullOrEmpty()] + [string]$vpgIdentifier, + [Parameter( + HelpMessage = "The starting date of the report, in RFC 3339 standard ('1970-01-01T00:00:00Z'). If only the end date is added, the start date by default will be the end date minus 7 days." + )] + [ValidateNotNullOrEmpty()] + [string]$startDate, + [Parameter( + HelpMessage = "The end date of the report, in RFC 3339 standard ('1970-01-01T00:00:00Z'). The default is the current time." + )] + [ValidateNotNullOrEmpty()] + [string]$endDate + ) + + $filter = Get-ZertoApiFilter -filtertable $PSBoundParameters + $uri = "reports/stats-journal-history{0}" -f $filter + Invoke-ZARestRequest -uri $uri +} diff --git a/ZertoApiWrapper/Public/Get-ZAJournalSiteAverageHistory.ps1 b/ZertoApiWrapper/Public/Get-ZAJournalSiteAverageHistory.ps1 new file mode 100644 index 0000000..a9a06f0 --- /dev/null +++ b/ZertoApiWrapper/Public/Get-ZAJournalSiteAverageHistory.ps1 @@ -0,0 +1,31 @@ +<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #> +function Get-ZAJournalSiteAverageHistory { + [CmdletBinding()] + param ( + [Parameter( + HelpMessage = "The identifier of the recovery site. A site identification is required for at least one site.", + Mandatory + )] + [ValidateNotNullOrEmpty()] + [string]$recoverySiteIdentifier, + [Parameter( + HelpMessage = "The starting date of the report, in RFC 3339 standard ('1970-01-01T00:00:00Z'). If only the end date is added, the start date by default will be the end date minus 7 days." + )] + [ValidateNotNullOrEmpty()] + [string]$startDate, + [Parameter( + HelpMessage = "The end date of the report, in RFC 3339 standard ('1970-01-01T00:00:00Z'). The default is the current time." + )] + [ValidateNotNullOrEmpty()] + [string]$endDate, + [Parameter( + HelpMessage = "The interval selected within the duration of the report. The interval can be per hour, for up to 15 days’ time frame or per day, for between 15 to 30 days' time frame. Submit value in Seconds" + )] + [ValidateRange(60, 2678400)] + [Int32]$interval + ) + + $filter = Get-ZertoApiFilter -filtertable $PSBoundParameters + $uri = "reports/site-journal-history-average{0}" -f $filter + Invoke-ZARestRequest -uri $uri +} diff --git a/ZertoApiWrapper/Public/Get-ZAJournalSiteAverageSize.ps1 b/ZertoApiWrapper/Public/Get-ZAJournalSiteAverageSize.ps1 new file mode 100644 index 0000000..822f46f --- /dev/null +++ b/ZertoApiWrapper/Public/Get-ZAJournalSiteAverageSize.ps1 @@ -0,0 +1,31 @@ +<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #> +function Get-ZAJournalSiteAverageSize { + [CmdletBinding()] + param ( + [Parameter( + HelpMessage = "The identifier of the recovery site. A site identification is required for at least one site.", + Mandatory + )] + [ValidateNotNullOrEmpty()] + [string]$recoverySiteIdentifier, + [Parameter( + HelpMessage = "The starting date of the report, in RFC 3339 standard ('1970-01-01T00:00:00Z'). If only the end date is added, the start date by default will be the end date minus 7 days." + )] + [ValidateNotNullOrEmpty()] + [string]$startDate, + [Parameter( + HelpMessage = "The end date of the report, in RFC 3339 standard ('1970-01-01T00:00:00Z'). The default is the current time." + )] + [ValidateNotNullOrEmpty()] + [string]$endDate, + [Parameter( + HelpMessage = "The interval selected within the duration of the report. The interval can be per hour, for up to 15 days’ time frame or per day, for between 15 to 30 days' time frame. Submit value in Seconds" + )] + [ValidateRange(60, 2678400)] + [Int32]$interval + ) + + $filter = Get-ZertoApiFilter -filtertable $PSBoundParameters + $uri = "reports/site-journal-size-average{0}" -f $filter + Invoke-ZARestRequest -uri $uri +} diff --git a/ZertoApiWrapper/Public/Get-ZAJournalSiteHistoryStat.ps1 b/ZertoApiWrapper/Public/Get-ZAJournalSiteHistoryStat.ps1 new file mode 100644 index 0000000..c911cd1 --- /dev/null +++ b/ZertoApiWrapper/Public/Get-ZAJournalSiteHistoryStat.ps1 @@ -0,0 +1,31 @@ +<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #> +function Get-ZAJournalSiteHistoryStat { + [CmdletBinding()] + param ( + [Parameter( + HelpMessage = "The identifier of the recovery site.", + Mandatory + )] + [ValidateNotNullOrEmpty()] + [string]$recoverySiteIdentifier, + [Parameter( + HelpMessage = "The starting date of the report, in RFC 3339 standard ('1970-01-01T00:00:00Z'). If only the end date is added, the start date by default will be the end date minus 7 days." + )] + [ValidateNotNullOrEmpty()] + [string]$startDate, + [Parameter( + HelpMessage = "The end date of the report, in RFC 3339 standard ('1970-01-01T00:00:00Z'). The default is the current time." + )] + [ValidateNotNullOrEmpty()] + [string]$endDate, + [Parameter( + HelpMessage = "The interval selected within the duration of the report. The interval can be per hour, for up to 15 days’ time frame or per day, for between 15 to 30 days' time frame. Submit value in Seconds" + )] + [ValidateRange(60, 2678400)] + [Int32]$interval + ) + + $filter = Get-ZertoApiFilter -filtertable $PSBoundParameters + $uri = "reports/site-journal-history-stats{0}" -f $filter + Invoke-ZARestRequest -uri $uri +} diff --git a/ZertoApiWrapper/Public/Get-ZAJournalSiteHistorySummary.ps1 b/ZertoApiWrapper/Public/Get-ZAJournalSiteHistorySummary.ps1 new file mode 100644 index 0000000..b8f2688 --- /dev/null +++ b/ZertoApiWrapper/Public/Get-ZAJournalSiteHistorySummary.ps1 @@ -0,0 +1,31 @@ +<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #> +function Get-ZAJournalSiteHistorySummary { + [CmdletBinding()] + param ( + [Parameter( + HelpMessage = "The identifier of the recovery site.", + Mandatory + )] + [ValidateNotNullOrEmpty()] + [string]$recoverySiteIdentifier, + [Parameter( + HelpMessage = "The starting date of the report, in RFC 3339 standard ('1970-01-01T00:00:00Z'). If only the end date is added, the start date by default will be the end date minus 7 days." + )] + [ValidateNotNullOrEmpty()] + [string]$startDate, + [Parameter( + HelpMessage = "The end date of the report, in RFC 3339 standard ('1970-01-01T00:00:00Z'). The default is the current time." + )] + [ValidateNotNullOrEmpty()] + [string]$endDate, + [Parameter( + HelpMessage = "The interval selected within the duration of the report. The interval can be per hour, for up to 15 days’ time frame or per day, for between 15 to 30 days' time frame. Submit value in Seconds" + )] + [ValidateRange(60, 2678400)] + [Int32]$interval + ) + + $filter = Get-ZertoApiFilter -filtertable $PSBoundParameters + $uri = "reports/site-journal-history-summary{0}" -f $filter + Invoke-ZARestRequest -uri $uri +} diff --git a/ZertoApiWrapper/Public/Get-ZAJournalSiteSizeStat.ps1 b/ZertoApiWrapper/Public/Get-ZAJournalSiteSizeStat.ps1 new file mode 100644 index 0000000..0f1df3e --- /dev/null +++ b/ZertoApiWrapper/Public/Get-ZAJournalSiteSizeStat.ps1 @@ -0,0 +1,31 @@ +<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #> +function Get-ZAJournalSiteSizeStat { + [CmdletBinding()] + param ( + [Parameter( + HelpMessage = "The identifier of the VPG.", + Mandatory + )] + [ValidateNotNullOrEmpty()] + [string]$recoverySiteIdentifier, + [Parameter( + HelpMessage = "The starting date of the report, in RFC 3339 standard ('1970-01-01T00:00:00Z'). If only the end date is added, the start date by default will be the end date minus 7 days." + )] + [ValidateNotNullOrEmpty()] + [string]$startDate, + [Parameter( + HelpMessage = "The end date of the report, in RFC 3339 standard ('1970-01-01T00:00:00Z'). The default is the current time." + )] + [ValidateNotNullOrEmpty()] + [string]$endDate, + [Parameter( + HelpMessage = "The interval selected within the duration of the report. The interval can be per hour, for up to 15 days’ time frame or per day, for between 15 to 30 days' time frame. Submit value in Seconds" + )] + [ValidateRange(60, 2678400)] + [Int32]$interval + ) + + $filter = Get-ZertoApiFilter -filtertable $PSBoundParameters + $uri = "reports/site-journal-size-stats{0}" -f $filter + Invoke-ZARestRequest -uri $uri +} diff --git a/ZertoApiWrapper/Public/Get-ZAJournalStatusProportion.ps1 b/ZertoApiWrapper/Public/Get-ZAJournalStatusProportion.ps1 new file mode 100644 index 0000000..9595675 --- /dev/null +++ b/ZertoApiWrapper/Public/Get-ZAJournalStatusProportion.ps1 @@ -0,0 +1,26 @@ +<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #> +function Get-ZAJournalStatusProportion { + [CmdletBinding()] + param ( + [Parameter( + HelpMessage = "The identifier of the VPG.", + Mandatory + )] + [ValidateNotNullOrEmpty()] + [string]$vpgIdentifier, + [Parameter( + HelpMessage = "The starting date of the report, in RFC 3339 standard ('1970-01-01T00:00:00Z'). If only the end date is added, the start date by default will be the end date minus 7 days." + )] + [ValidateNotNullOrEmpty()] + [string]$startDate, + [Parameter( + HelpMessage = "The end date of the report, in RFC 3339 standard ('1970-01-01T00:00:00Z'). The default is the current time." + )] + [ValidateNotNullOrEmpty()] + [string]$endDate + ) + + $filter = Get-ZertoApiFilter -filtertable $PSBoundParameters + $uri = "reports/journal-statuses-proportions{0}" -f $filter + Invoke-ZARestRequest -uri $uri +} diff --git a/ZertoApiWrapper/Public/Get-ZAJournalStorageStat.ps1 b/ZertoApiWrapper/Public/Get-ZAJournalStorageStat.ps1 new file mode 100644 index 0000000..cf2f520 --- /dev/null +++ b/ZertoApiWrapper/Public/Get-ZAJournalStorageStat.ps1 @@ -0,0 +1,26 @@ +<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #> +function Get-ZAJournalStorageStat { + [CmdletBinding()] + param ( + [Parameter( + HelpMessage = "The identifier of the VPG.", + Mandatory + )] + [ValidateNotNullOrEmpty()] + [string]$vpgIdentifier, + [Parameter( + HelpMessage = "The starting date of the report, in RFC 3339 standard ('1970-01-01T00:00:00Z'). If only the end date is added, the start date by default will be the end date minus 7 days." + )] + [ValidateNotNullOrEmpty()] + [string]$startDate, + [Parameter( + HelpMessage = "The end date of the report, in RFC 3339 standard ('1970-01-01T00:00:00Z'). The default is the current time." + )] + [ValidateNotNullOrEmpty()] + [string]$endDate + ) + + $filter = Get-ZertoApiFilter -filtertable $PSBoundParameters + $uri = "reports/stats-journal-storage{0}" -f $filter + Invoke-ZARestRequest -uri $uri +} diff --git a/ZertoApiWrapper/Public/Get-ZAJournalSummary.ps1 b/ZertoApiWrapper/Public/Get-ZAJournalSummary.ps1 new file mode 100644 index 0000000..cdcdb9a --- /dev/null +++ b/ZertoApiWrapper/Public/Get-ZAJournalSummary.ps1 @@ -0,0 +1,26 @@ +<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #> +function Get-ZAJournalSummary { + [CmdletBinding()] + param ( + [Parameter( + HelpMessage = "The identifier of the VPG.", + Mandatory + )] + [ValidateNotNullOrEmpty()] + [string]$vpgIdentifier, + [Parameter( + HelpMessage = "The starting date of the report, in RFC 3339 standard ('1970-01-01T00:00:00Z'). If only the end date is added, the start date by default will be the end date minus 7 days." + )] + [ValidateNotNullOrEmpty()] + [string]$startDate, + [Parameter( + HelpMessage = "The end date of the report, in RFC 3339 standard ('1970-01-01T00:00:00Z'). The default is the current time." + )] + [ValidateNotNullOrEmpty()] + [string]$endDate + ) + + $filter = Get-ZertoApiFilter -filtertable $PSBoundParameters + $uri = "reports/journal-summary{0}" -f $filter + Invoke-ZARestRequest -uri $uri +} diff --git a/ZertoApiWrapper/Public/Get-ZALicense.ps1 b/ZertoApiWrapper/Public/Get-ZALicense.ps1 new file mode 100644 index 0000000..bd1bd94 --- /dev/null +++ b/ZertoApiWrapper/Public/Get-ZALicense.ps1 @@ -0,0 +1,7 @@ +<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #> +function Get-ZALicense { + [cmdletbinding()] + param() + $uri = "licenses" + Invoke-ZARestRequest -uri $uri +} \ No newline at end of file diff --git a/ZertoApiWrapper/Public/Get-ZAMonitoring.ps1 b/ZertoApiWrapper/Public/Get-ZAMonitoring.ps1 new file mode 100644 index 0000000..a196baa --- /dev/null +++ b/ZertoApiWrapper/Public/Get-ZAMonitoring.ps1 @@ -0,0 +1,18 @@ +<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #> +function Get-ZAMonitoring { + [cmdletbinding()] + param( + [Parameter( + HelpMessage = "The ZORG identifier by which to filter the user's statistics for a single account. If the ZORG identifier is omitted, statistics related to all sites, for a single account, is retrieved." + )] + [ValidateNotNullOrEmpty()] + [string]$zOrgIdentifier + ) + $uri = "monitoring/" + if ( -not [String]::IsNullorEmpty($zOrgIdentifier) ){ + $filterTable = @{"zOrgIdentifier" = $zOrgIdentifier} + $filterString = Get-ZertoApiFilter -filterTable $filterTable + $uri = "{0}{1}" -f $uri, $filterString + } + Invoke-ZARestRequest -uri $uri +} \ No newline at end of file diff --git a/ZertoApiWrapper/Public/Get-ZANetworkSiteAverageIOPS.ps1 b/ZertoApiWrapper/Public/Get-ZANetworkSiteAverageIOPS.ps1 new file mode 100644 index 0000000..e329788 --- /dev/null +++ b/ZertoApiWrapper/Public/Get-ZANetworkSiteAverageIOPS.ps1 @@ -0,0 +1,53 @@ +<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #> +function Get-ZANetworkSiteAverageIOPS { + [CmdletBinding(DefaultParameterSetName = "ProtectedSite")] + param ( + [Parameter( + HelpMessage = "Protected site identifier. A site identification is required for at least one of the sites.", + ParameterSetName = "ProtectedSite", + Mandatory + )] + [Parameter( + HelpMessage = "Protected site identifier. A site identification is required for at least one of the sites.", + ParameterSetName = "RecoverySite" + )] + [ValidateNotNullOrEmpty()] + [string]$protectedSiteIdentifier, + [Parameter( + HelpMessage = "Recovery site identifier. If the recovery site identifier is omitted, the API will show all outgoing traffic from the protected site to its replicating sites.", + ParameterSetName = "RecoverySite", + Mandatory + )] + [Parameter( + HelpMessage = "Recovery site identifier. If the recovery site identifier is omitted, the API will show all outgoing traffic from the protected site to its replicating sites.", + ParameterSetName = "ProtectedSite" + )] + [ValidateNotNullOrEmpty()] + [string]$recoverySiteIdentifier, + [Parameter( + HelpMessage = "Start date in RFC 3339 standard ('1970-01-01T00:00:00Z'). If the start date is omitted, the default start date is 7 days before the end date." + )] + [ValidateNotNullOrEmpty()] + [string]$startDate, + [Parameter( + HelpMessage = "End date in RFC 3339 standard ('1970-01-01T00:00:00Z'). If the end date is omitted, the default end date is the current time." + )] + [ValidateNotNullOrEmpty()] + [string]$endDate, + [Parameter( + HelpMessage = "The ZORG identifier by which to filter the executive summary." + )] + [ValidateNotNullOrEmpty()] + [string]$zOrgIdentifier, + [Parameter( + HelpMessage = "The interval selected within the duration of the report. The interval can be per hour, for up to 15 days’ time frame or per day, for between 15 to 30 days' time frame. Submit value in Seconds" + )] + [ValidateRange(60, 2678400)] + [Int32]$interval + + ) + + $filter = Get-ZertoAPIFilter -filtertable $PSBoundParameters + $uri = "reports/sites-network-iops-average{0}" -f $filter + Invoke-ZARestRequest -uri $uri +} diff --git a/ZertoApiWrapper/Public/Get-ZANetworkSiteAveragePerformance.ps1 b/ZertoApiWrapper/Public/Get-ZANetworkSiteAveragePerformance.ps1 new file mode 100644 index 0000000..ad8addc --- /dev/null +++ b/ZertoApiWrapper/Public/Get-ZANetworkSiteAveragePerformance.ps1 @@ -0,0 +1,52 @@ +<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #> +function Get-ZANetworkSiteAveragePerformance { + [CmdletBinding(DefaultParameterSetName = "ProtectedSite")] + param ( + [Parameter( + HelpMessage = "Protected site identifier. A site identification is required for at least one of the sites.", + ParameterSetName = "ProtectedSite", + Mandatory + )] + [Parameter( + HelpMessage = "Protected site identifier. A site identification is required for at least one of the sites.", + ParameterSetName = "RecoverySite" + )] + [ValidateNotNullOrEmpty()] + [string]$protectedSiteIdentifier, + [Parameter( + HelpMessage = "Recovery site identifier. If the recovery site identifier is omitted, the API will show all outgoing traffic from the protected site to its replicating sites.", + ParameterSetName = "RecoverySite", + Mandatory + )] + [Parameter( + HelpMessage = "Recovery site identifier. If the recovery site identifier is omitted, the API will show all outgoing traffic from the protected site to its replicating sites.", + ParameterSetName = "ProtectedSite" + )] + [ValidateNotNullOrEmpty()] + [string]$recoverySiteIdentifier, + [Parameter( + HelpMessage = "Start date in RFC 3339 standard ('1970-01-01T00:00:00Z'). If the start date is omitted, the default start date is 7 days before the end date." + )] + [ValidateNotNullOrEmpty()] + [string]$startDate, + [Parameter( + HelpMessage = "End date in RFC 3339 standard ('1970-01-01T00:00:00Z'). If the end date is omitted, the default end date is the current time." + )] + [ValidateNotNullOrEmpty()] + [string]$endDate, + [Parameter( + HelpMessage = "The ZORG identifier by which to filter the executive summary." + )] + [ValidateNotNullOrEmpty()] + [string]$zOrgIdentifier, + [Parameter( + HelpMessage = "The interval selected within the duration of the report. The interval can be per hour, for up to 15 days’ time frame or per day, for between 15 to 30 days' time frame. Submit value in Seconds" + )] + [ValidateRange(60, 2678400)] + [Int32]$interval + ) + + $filter = Get-ZertoAPIFilter -filtertable $PSBoundParameters + $uri = "reports/sites-network-performance-average{0}" -f $filter + Invoke-ZARestRequest -uri $uri +} diff --git a/ZertoApiWrapper/Public/Get-ZANetworkSiteStat.ps1 b/ZertoApiWrapper/Public/Get-ZANetworkSiteStat.ps1 new file mode 100644 index 0000000..6762b4a --- /dev/null +++ b/ZertoApiWrapper/Public/Get-ZANetworkSiteStat.ps1 @@ -0,0 +1,47 @@ +<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #> +function Get-ZANetworkSiteStat { + [CmdletBinding(DefaultParameterSetName = "ProtectedSite")] + param ( + [Parameter( + HelpMessage = "Protected site identifier. A site identification is required for at least one of the sites.", + ParameterSetName = "ProtectedSite", + Mandatory + )] + [Parameter( + HelpMessage = "Protected site identifier. A site identification is required for at least one of the sites.", + ParameterSetName = "RecoverySite" + )] + [ValidateNotNullOrEmpty()] + [string]$protectedSiteIdentifier, + [Parameter( + HelpMessage = "Recovery site identifier. If the recovery site identifier is omitted, the API will show all outgoing traffic from the protected site to its replicating sites.", + ParameterSetName = "RecoverySite", + Mandatory + )] + [Parameter( + HelpMessage = "Recovery site identifier. If the recovery site identifier is omitted, the API will show all outgoing traffic from the protected site to its replicating sites.", + ParameterSetName = "ProtectedSite" + )] + [ValidateNotNullOrEmpty()] + [string]$recoverySiteIdentifier, + [Parameter( + HelpMessage = "Start date in RFC 3339 standard ('1970-01-01T00:00:00Z'). If the start date is omitted, the default start date is 7 days before the end date." + )] + [ValidateNotNullOrEmpty()] + [string]$startDate, + [Parameter( + HelpMessage = "End date in RFC 3339 standard ('1970-01-01T00:00:00Z'). If the end date is omitted, the default end date is the current time." + )] + [ValidateNotNullOrEmpty()] + [string]$endDate, + [Parameter( + HelpMessage = "The ZORG identifier by which to filter the executive summary." + )] + [ValidateNotNullOrEmpty()] + [string]$zOrgIdentifier + ) + + $filter = Get-ZertoAPIFilter -filtertable $PSBoundParameters + $uri = "reports/sites-network-stats{0}" -f $filter + Invoke-ZARestRequest -uri $uri +} diff --git a/ZertoApiWrapper/Public/Get-ZANetworkSiteSummary.ps1 b/ZertoApiWrapper/Public/Get-ZANetworkSiteSummary.ps1 new file mode 100644 index 0000000..8257ae2 --- /dev/null +++ b/ZertoApiWrapper/Public/Get-ZANetworkSiteSummary.ps1 @@ -0,0 +1,47 @@ +<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #> +function Get-ZANetworkSiteSummary { + [CmdletBinding(DefaultParameterSetName = "ProtectedSite")] + param ( + [Parameter( + HelpMessage = "Protected site identifier. A site identification is required for at least one of the sites.", + ParameterSetName = "ProtectedSite", + Mandatory + )] + [Parameter( + HelpMessage = "Protected site identifier. A site identification is required for at least one of the sites.", + ParameterSetName = "RecoverySite" + )] + [ValidateNotNullOrEmpty()] + [string]$protectedSiteIdentifier, + [Parameter( + HelpMessage = "Recovery site identifier. If the recovery site identifier is omitted, the API will show all outgoing traffic from the protected site to its replicating sites.", + ParameterSetName = "RecoverySite", + Mandatory + )] + [Parameter( + HelpMessage = "Recovery site identifier. If the recovery site identifier is omitted, the API will show all outgoing traffic from the protected site to its replicating sites.", + ParameterSetName = "ProtectedSite" + )] + [ValidateNotNullOrEmpty()] + [string]$recoverySiteIdentifier, + [Parameter( + HelpMessage = "Start date in RFC 3339 standard ('1970-01-01T00:00:00Z'). If the start date is omitted, the default start date is 7 days before the end date." + )] + [ValidateNotNullOrEmpty()] + [string]$startDate, + [Parameter( + HelpMessage = "End date in RFC 3339 standard ('1970-01-01T00:00:00Z'). If the end date is ommitted, the default end date is the current time." + )] + [ValidateNotNullOrEmpty()] + [string]$endDate, + [Parameter( + HelpMessage = "The ZORG identifier by which to filter the executive summary." + )] + [ValidateNotNullOrEmpty()] + [string]$zOrgIdentifier + ) + + $filter = Get-ZertoAPIFilter -filtertable $PSBoundParameters + $uri = "reports/sites-network-summary{0}" -f $filter + Invoke-ZARestRequest -uri $uri +} diff --git a/ZertoApiWrapper/Public/Get-ZANetworkVpgAverageIOPS.ps1 b/ZertoApiWrapper/Public/Get-ZANetworkVpgAverageIOPS.ps1 new file mode 100644 index 0000000..b8eb8eb --- /dev/null +++ b/ZertoApiWrapper/Public/Get-ZANetworkVpgAverageIOPS.ps1 @@ -0,0 +1,31 @@ +<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #> +function Get-ZANetworkVpgAverageIOPS { + [CmdletBinding()] + param ( + [Parameter( + HelpMessage = "The VPG identifier.", + Mandatory + )] + [ValidateNotNullOrEmpty()] + [string]$vpgIdentifier, + [Parameter( + HelpMessage = "Start date in RFC 3339 standard ('1970-01-01T00:00:00Z'). If the start date is omitted, the default start date is 7 days before the end date." + )] + [ValidateNotNullOrEmpty()] + [string]$startDate, + [Parameter( + HelpMessage = "End date in RFC 3339 standard ('1970-01-01T00:00:00Z'). If the end date is omitted, the default end date is the current time." + )] + [ValidateNotNullOrEmpty()] + [string]$endDate, + [Parameter( + HelpMessage = "The interval selected within the duration of the report. The interval can be per minute - for up to 6 hours, per hour - for 6 hours to 15 days, or per day - for 15 days up to 30 days. If an interval is not specified, the default is 60 seconds. Submit value in Seconds." + )] + [ValidateRange(60, 2678400)] + [Int32]$interval + ) + + $filter = Get-ZertoAPIFilter -filtertable $PSBoundParameters + $uri = "reports/vpg-network-iops-average{0}" -f $filter + Invoke-ZARestRequest -uri $uri +} diff --git a/ZertoApiWrapper/Public/Get-ZANetworkVpgAveragePerformance.ps1 b/ZertoApiWrapper/Public/Get-ZANetworkVpgAveragePerformance.ps1 new file mode 100644 index 0000000..0485cdb --- /dev/null +++ b/ZertoApiWrapper/Public/Get-ZANetworkVpgAveragePerformance.ps1 @@ -0,0 +1,31 @@ +<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #> +function Get-ZANetworkVpgAveragePerformance { + [CmdletBinding()] + param ( + [Parameter( + HelpMessage = "The VPG identifier.", + Mandatory + )] + [ValidateNotNullOrEmpty()] + [string]$vpgIdentifier, + [Parameter( + HelpMessage = "Start date in RFC 3339 standard ('1970-01-01T00:00:00Z'). If the start date is omitted, the default start date is 7 days before the end date." + )] + [ValidateNotNullOrEmpty()] + [string]$startDate, + [Parameter( + HelpMessage = "End date in RFC 3339 standard ('1970-01-01T00:00:00Z'). If the end date is omitted, the default end date is the current time." + )] + [ValidateNotNullOrEmpty()] + [string]$endDate, + [Parameter( + HelpMessage = "The interval selected within the duration of the report. The interval can be per minute - for up to 6 hours, per hour - for 6 hours to 15 days, or per day - for 15 days up to 30 days. If an interval is not specified, the default is 60 seconds. Submit value in Seconds." + )] + [ValidateRange(60, 2678400)] + [Int32]$interval + ) + + $filter = Get-ZertoAPIFilter -filtertable $PSBoundParameters + $uri = "reports/vpg-network-performance-average{0}" -f $filter + Invoke-ZARestRequest -uri $uri +} diff --git a/ZertoApiWrapper/Public/Get-ZANetworkVpgStat.ps1 b/ZertoApiWrapper/Public/Get-ZANetworkVpgStat.ps1 new file mode 100644 index 0000000..c135c6f --- /dev/null +++ b/ZertoApiWrapper/Public/Get-ZANetworkVpgStat.ps1 @@ -0,0 +1,26 @@ +<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #> +function Get-ZANetworkVpgStat { + [CmdletBinding()] + param ( + [Parameter( + HelpMessage = "The VPG identifier.", + Mandatory + )] + [ValidateNotNullOrEmpty()] + [string]$vpgIdentifier, + [Parameter( + HelpMessage = "Start date in RFC 3339 standard ('1970-01-01T00:00:00Z'). If the start date is omitted, the default start date is 7 days before the end date." + )] + [ValidateNotNullOrEmpty()] + [string]$startDate, + [Parameter( + HelpMessage = "End date in RFC 3339 standard ('1970-01-01T00:00:00Z'). If the end date is omitted, the default end date is the current time." + )] + [ValidateNotNullOrEmpty()] + [string]$endDate + ) + + $filter = Get-ZertoAPIFilter -filtertable $PSBoundParameters + $uri = "reports/vpg-network-stats{0}" -f $filter + Invoke-ZARestRequest -uri $uri +} diff --git a/ZertoApiWrapper/Public/Get-ZANetworkVpgSummary.ps1 b/ZertoApiWrapper/Public/Get-ZANetworkVpgSummary.ps1 new file mode 100644 index 0000000..3654fcd --- /dev/null +++ b/ZertoApiWrapper/Public/Get-ZANetworkVpgSummary.ps1 @@ -0,0 +1,26 @@ +<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #> +function Get-ZANetworkVpgSummary { + [CmdletBinding()] + param ( + [Parameter( + HelpMessage = "The VPG identifier.", + Mandatory + )] + [ValidateNotNullOrEmpty()] + [string]$vpgIdentifier, + [Parameter( + HelpMessage = "Start date in RFC 3339 standard ('1970-01-01T00:00:00Z'). If the start date is omitted, the default start date is 7 days before the end date." + )] + [ValidateNotNullOrEmpty()] + [string]$startDate, + [Parameter( + HelpMessage = "End date in RFC 3339 standard ('1970-01-01T00:00:00Z'). If the end date is omitted, the default end date is the current time." + )] + [ValidateNotNullOrEmpty()] + [string]$endDate + ) + + $filter = Get-ZertoAPIFilter -filtertable $PSBoundParameters + $uri = "reports/vpg-network-summary{0}" -f $filter + Invoke-ZARestRequest -uri $uri +} diff --git a/ZertoApiWrapper/Public/Get-ZAPlannerJournalSizeReport.ps1 b/ZertoApiWrapper/Public/Get-ZAPlannerJournalSizeReport.ps1 new file mode 100644 index 0000000..5ea91a5 --- /dev/null +++ b/ZertoApiWrapper/Public/Get-ZAPlannerJournalSizeReport.ps1 @@ -0,0 +1,58 @@ +<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #> +function Get-ZAPlannerJournalSizeReport { + [cmdletbinding()] + param( + [Parameter( + Mandatory, + HelpMessage = "The site identifier(s) for which to return detailed information." + )] + [ValidateNotNullOrEmpty()] + [string]$siteIdentifier, + [Parameter( + Mandatory, + HelpMessage = "Type of target recovery site." + )] + [ValidateSet('azure', 'vcenter', 'vcd', 'scvmm', 'aws')] + [string]$recoveryType, + [Parameter( + Mandatory, + HelpMessage = "Identifiers of the VMs you want to recover at the target recovery site." + )] + [ValidateNotNullOrEmpty()] + [string[]]$vmIdentifier, + [Parameter( + HelpMessage = "The desired journal history in hours. The default is 24 hours. Limited to a 1 hour up to 720 hours, or the equivalent of 30 days" + )] + [ValidateRange(1, 720)] + [Int]$desiredJournalHistory = 24, + [Parameter( + HelpMessage = "The earliest timestamp of an event to return, in RFC 3339 standard. ('1970-01-01T00:00:00Z'). The default is one year ago." + )] + [ValidateNotNullOrEmpty()] + [string]$startDate, + [Parameter( + HelpMessage = "The latest timestamp of an event to return, in RFC 3339 standard. ('1970-01-01T00:00:00Z'). The default is the current time." + )] + [ValidateNotNullOrEmpty()] + [string]$endDate + ) + $uri = "planner/reports/stats/journal-size" + $body = @{ + siteIdentifier = $siteIdentifier + recoveryType = $recoveryType + desiredJournalHistory = $desiredJournalHistory + vms = New-Object System.Collections.Generic.List[psobject] + } + if ( -not [String]::IsNullOrEmpty($startDate) ) { + $body['startDate'] = $startDate + } + if ( -not [String]::IsNullOrEmpty($endDate) ) { + $body['endDate'] = $endDate + } + foreach ($vmId in $vmIdentifier) { + $body['vms'].Add(@{'identifier' = $vmId; 'desiredJournalHistory' = $desiredJournalHistory }) + } + $reportId = Invoke-ZARestRequest -uri $uri -method POST -body ($body | ConvertTo-Json) + $uri = '{0}?reportId={1}' -f $uri, $reportId.reportId + Invoke-ZARestRequest -uri $uri +} diff --git a/ZertoApiWrapper/Public/Get-ZAPlannerNetworkPerformanceReport.ps1 b/ZertoApiWrapper/Public/Get-ZAPlannerNetworkPerformanceReport.ps1 new file mode 100644 index 0000000..c0a6b12 --- /dev/null +++ b/ZertoApiWrapper/Public/Get-ZAPlannerNetworkPerformanceReport.ps1 @@ -0,0 +1,58 @@ +<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #> +function Get-ZAPlannerNetworkPerformanceReport { + [cmdletbinding()] + param( + [Parameter( + Mandatory, + HelpMessage = "The site identifier(s) for which to return detailed information." + )] + [ValidateNotNullOrEmpty()] + [string]$siteIdentifier, + [Parameter( + Mandatory, + HelpMessage = "Type of target recovery site." + )] + [ValidateSet('azure', 'vcenter', 'vcd', 'scvmm', 'aws')] + [string]$recoveryType, + [Parameter( + Mandatory, + HelpMessage = "Identifiers of the VMs you want to recover at the target recovery site." + )] + [ValidateNotNullOrEmpty()] + [string[]]$vmIdentifier, + [Parameter( + HelpMessage = "The desired sample interval in seconds. The default is 3600 seconds (1 Hour). Limited to a 60 second to 86,400 second (24 Hour) interval" + )] + [ValidateRange(60, 86400)] + [Int]$interval = 3600, + [Parameter( + HelpMessage = "The earliest timestamp of an event to return, in RFC 3339 standard. ('1970-01-01T00:00:00Z'). The default is one year ago." + )] + [ValidateNotNullOrEmpty()] + [string]$startDate, + [Parameter( + HelpMessage = "The latest timestamp of an event to return, in RFC 3339 standard. ('1970-01-01T00:00:00Z'). The default is the current time." + )] + [ValidateNotNullOrEmpty()] + [string]$endDate + ) + $uri = "planner/reports/network-performance" + $body = @{ + siteIdentifier = $siteIdentifier + recoveryType = $recoveryType + interval = $interval + vmIdentifiers = New-Object System.Collections.Generic.List[psobject] + } + if ( -not [String]::IsNullOrEmpty($startDate) ) { + $body['startDate'] = $startDate + } + if ( -not [String]::IsNullOrEmpty($endDate) ) { + $body['endDate'] = $endDate + } + foreach ($vmId in $vmIdentifier) { + $body['vmIdentifiers'].Add($vmId) + } + $reportId = Invoke-ZARestRequest -uri $uri -method POST -body ($body | ConvertTo-Json) + $uri = '{0}?reportId={1}' -f $uri, $reportId.reportId + Invoke-ZARestRequest -uri $uri +} diff --git a/ZertoApiWrapper/Public/Get-ZAPlannerSite.ps1 b/ZertoApiWrapper/Public/Get-ZAPlannerSite.ps1 new file mode 100644 index 0000000..44adc6c --- /dev/null +++ b/ZertoApiWrapper/Public/Get-ZAPlannerSite.ps1 @@ -0,0 +1,22 @@ +<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #> +function Get-ZAPlannerSite { + [cmdletbinding()] + param( + [Parameter( + HelpMessage = "The site identifier(s) for which to return detailed information." + )] + [ValidateNotNullOrEmpty()] + [string[]]$siteIdentifier + ) + $uri = "planner/sites" + if ( -not [String]::IsNullorEmpty($siteIdentifier) ) { + $entry = foreach ($id in $siteIdentifier) { + "{0}/{1}" -f $uri, $id + } + } else { + $entry = $uri + } + foreach ($uri in $entry) { + Invoke-ZARestRequest -uri $uri + } +} diff --git a/ZertoApiWrapper/Public/Get-ZAPlannerStatsReport.ps1 b/ZertoApiWrapper/Public/Get-ZAPlannerStatsReport.ps1 new file mode 100644 index 0000000..e247c86 --- /dev/null +++ b/ZertoApiWrapper/Public/Get-ZAPlannerStatsReport.ps1 @@ -0,0 +1,58 @@ +<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #> +function Get-ZAPlannerStatsReport { + [cmdletbinding()] + param( + [Parameter( + Mandatory, + HelpMessage = "The site identifier(s) for which to return detailed information." + )] + [ValidateNotNullOrEmpty()] + [string]$siteIdentifier, + [Parameter( + Mandatory, + HelpMessage = "Type of target recovery site." + )] + [ValidateSet('azure', 'vcenter', 'vcd', 'scvmm', 'aws')] + [string]$recoveryType, + [Parameter( + Mandatory, + HelpMessage = "Identifiers of the VMs you want to recover at the target recovery site." + )] + [ValidateNotNullOrEmpty()] + [string[]]$vmIdentifier, + [Parameter( + HelpMessage = "The desired journal history in hours. The default is 24 hours. Limited to a 1 hour up to 720 hours, or the equivalent of 30 days" + )] + [ValidateRange(1, 720)] + [Int]$desiredJournalHistory = 24, + [Parameter( + HelpMessage = "The earliest timestamp of an event to return, in RFC 3339 standard. ('1970-01-01T00:00:00Z'). The default is one year ago." + )] + [ValidateNotNullOrEmpty()] + [string]$startDate, + [Parameter( + HelpMessage = "The latest timestamp of an event to return, in RFC 3339 standard. ('1970-01-01T00:00:00Z'). The default is the current time." + )] + [ValidateNotNullOrEmpty()] + [string]$endDate + ) + $uri = "planner/reports/stats" + $body = @{ + siteIdentifier = $siteIdentifier + recoveryType = $recoveryType + desiredJournalHistory = $desiredJournalHistory + vms = New-Object System.Collections.Generic.List[psobject] + } + if ( -not [String]::IsNullOrEmpty($startDate) ) { + $body['startDate'] = $startDate + } + if ( -not [String]::IsNullOrEmpty($endDate) ) { + $body['endDate'] = $endDate + } + foreach ($vmId in $vmIdentifier) { + $body['vms'].Add(@{'identifier' = $vmId; 'desiredJournalHistory' = $desiredJournalHistory }) + } + $reportId = Invoke-ZARestRequest -uri $uri -method POST -body ($body | ConvertTo-Json) + $uri = '{0}?reportId={1}' -f $uri, $reportId.reportId + Invoke-ZARestRequest -uri $uri +} diff --git a/ZertoApiWrapper/Public/Get-ZAPlannerWanReport.ps1 b/ZertoApiWrapper/Public/Get-ZAPlannerWanReport.ps1 new file mode 100644 index 0000000..f678504 --- /dev/null +++ b/ZertoApiWrapper/Public/Get-ZAPlannerWanReport.ps1 @@ -0,0 +1,52 @@ +<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #> +function Get-ZAPlannerWanReport { + [cmdletbinding()] + param( + [Parameter( + Mandatory, + HelpMessage = "The site identifier(s) for which to return detailed information." + )] + [ValidateNotNullOrEmpty()] + [string]$siteIdentifier, + [Parameter( + Mandatory, + HelpMessage = "Type of target recovery site." + )] + [ValidateSet('azure', 'vcenter', 'vcd', 'scvmm', 'aws')] + [string]$recoveryType, + [Parameter( + Mandatory, + HelpMessage = "Identifiers of the VMs you want to recover at the target recovery site." + )] + [ValidateNotNullOrEmpty()] + [string[]]$vmIdentifier, + [Parameter( + HelpMessage = "The earliest timestamp of an event to return, in RFC 3339 standard. ('1970-01-01T00:00:00Z'). The default is one year ago." + )] + [ValidateNotNullOrEmpty()] + [string]$startDate, + [Parameter( + HelpMessage = "The latest timestamp of an event to return, in RFC 3339 standard. ('1970-01-01T00:00:00Z'). The default is the current time." + )] + [ValidateNotNullOrEmpty()] + [string]$endDate + ) + $uri = "planner/reports/stats/wan" + $body = @{ + siteIdentifier = $siteIdentifier + recoveryType = $recoveryType + vmIdentifiers = New-Object System.Collections.Generic.List[psobject] + } + if ( -not [String]::IsNullOrEmpty($startDate) ) { + $body['startDate'] = $startDate + } + if ( -not [String]::IsNullOrEmpty($endDate) ) { + $body['endDate'] = $endDate + } + foreach ($vmId in $vmIdentifier) { + $body['vmIdentifiers'].Add($vmId) + } + $reportId = Invoke-ZARestRequest -uri $uri -method POST -body ($body | ConvertTo-Json) + $uri = '{0}?reportId={1}' -f $uri, $reportId.reportId + Invoke-ZARestRequest -uri $uri +} diff --git a/ZertoApiWrapper/Public/Get-ZAPlannerZcasReport.ps1 b/ZertoApiWrapper/Public/Get-ZAPlannerZcasReport.ps1 new file mode 100644 index 0000000..c278502 --- /dev/null +++ b/ZertoApiWrapper/Public/Get-ZAPlannerZcasReport.ps1 @@ -0,0 +1,54 @@ +<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #> +function Get-ZAPlannerZcasReport { + [cmdletbinding()] + param( + [Parameter( + Mandatory, + HelpMessage = "The site identifier(s) for which to return detailed information." + )] + [ValidateNotNullOrEmpty()] + [string]$siteIdentifier, + [Parameter( + Mandatory, + HelpMessage = "Type of target recovery site." + )] + [ValidateSet('azure', 'vcenter', 'vcd', 'scvmm', 'aws')] + [string]$recoveryType, + [Parameter( + Mandatory, + HelpMessage = "Identifiers of the VMs you want to recover at the target recovery site." + )] + [ValidateNotNullOrEmpty()] + [string[]]$vmIdentifier, + [Parameter( + HelpMessage = "The earliest timestamp of an event to return, in RFC 3339 standard. ('1970-01-01T00:00:00Z'). The default is one year ago." + )] + [ValidateNotNullOrEmpty()] + [string]$startDate, + [Parameter( + HelpMessage = "The latest timestamp of an event to return, in RFC 3339 standard. ('1970-01-01T00:00:00Z'). The default is the current time." + )] + [ValidateNotNullOrEmpty()] + [string]$endDate + ) + $uri = "planner/reports/stats/zcas" + $body = @{ + siteIdentifier = $siteIdentifier + recoveryType = $recoveryType + vmIdentifiers = New-Object System.Collections.Generic.List[psobject] + } + if ( -not [String]::IsNullOrEmpty($startDate) ) { + $body['startDate'] = $startDate + } + if ( -not [String]::IsNullOrEmpty($endDate) ) { + $body['endDate'] = $endDate + } + foreach ($vmId in $vmIdentifier) { + $body['vmIdentifiers'].Add($vmId) + } + #$body | ConvertTo-Json + $reportId = Invoke-ZARestRequest -uri $uri -method POST -body ($body | ConvertTo-Json) + #Start-Sleep 10 + $uri = '{0}?reportId={1}' -f $uri, $reportId.reportId + Invoke-ZARestRequest -uri $uri +} diff --git a/ZertoApiWrapper/Public/Get-ZAProtectedVm.ps1 b/ZertoApiWrapper/Public/Get-ZAProtectedVm.ps1 new file mode 100644 index 0000000..86299ba --- /dev/null +++ b/ZertoApiWrapper/Public/Get-ZAProtectedVm.ps1 @@ -0,0 +1,51 @@ +<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #> +function Get-ZAProtectedVm { + [cmdletbinding(DefaultParameterSetName = "AllVMs")] + param( + [Parameter( + ParameterSetName = "AllVMs", + HelpMessage = "Use this switch when you want a list of all protected VMs. Please be warned this list can be quite large." + )] + [switch]$AllVms, + [Parameter( + ParameterSetName = "IndividualVMs", + Mandatory, + HelpMessage = "A list of VM identifiers to query" + )] + [ValidateNotNullOrEmpty()] + [string[]]$VMIdentifier, + [Parameter( + ParameterSetName = "IndividualVMs", + HelpMessage = "Specify this switch when you would like protected vms' volume information returned" + )] + [switch]$Volumes + ) + + Begin { + + } + + Process { + $BaseUri = "monitoring/protected-vms" + switch ($PSCmdlet.ParameterSetName) { + "AllVMs" { + Invoke-ZARestRequest -uri $BaseUri + } + + "IndividualVMs" { + foreach ($identifier in $VMIdentifier) { + if ($Volumes.IsPresent) { + $Uri = "{0}/{1}/volumes" -f $BaseUri, $identifier + } else { + $uri = $Uri = "{0}/{1}" -f $BaseUri, $identifier + } + Invoke-ZARestRequest -uri $Uri + } + } + } + } + + End { + + } +} diff --git a/ZertoApiWrapper/Public/Get-ZAProtectedVmReport.ps1 b/ZertoApiWrapper/Public/Get-ZAProtectedVmReport.ps1 new file mode 100644 index 0000000..c02b0cd --- /dev/null +++ b/ZertoApiWrapper/Public/Get-ZAProtectedVmReport.ps1 @@ -0,0 +1,32 @@ +<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #> +function Get-ZAProtectedVmReport { + [cmdletbinding()] + param( + [Parameter( + ParameterSetName = "GenerateReport", + Mandatory, + HelpMessage = "A list of VM identifiers to include in the report." + )] + [ValidateNotNullOrEmpty()] + [string[]]$VMIdentifier + ) + + Begin { + + } + + Process { + $BaseUri = "monitoring/protected-vms" + $Body = @{ + vmsIdentifiers = $VMIdentifier + } + $reportId = Invoke-ZARestRequest -uri $BaseUri -method POST -body ($Body | ConvertTo-Json) + Start-Sleep 1 + $Uri = "{0}?reportId={1}" -f $BaseUri, $reportId.reportId + Invoke-ZARestRequest -uri $Uri + } + + End { + + } +} diff --git a/ZertoApiWrapper/Public/Get-ZARPOAccountAverage.ps1 b/ZertoApiWrapper/Public/Get-ZARPOAccountAverage.ps1 new file mode 100644 index 0000000..d9149fc --- /dev/null +++ b/ZertoApiWrapper/Public/Get-ZARPOAccountAverage.ps1 @@ -0,0 +1,25 @@ +<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #> +function Get-ZARPOAccountAverage { + [CmdletBinding()] + param ( + [Parameter( + Helpmessage = "The ZORG identifier by which to filter the user's average RPO for a single account. If the ZORG identifier is omitted, statistics related to all sites, for a single account, is retrieved." + )] + [ValidateNotNullOrEmpty()] + [string]$zOrgIdentifier, + [Parameter( + HelpMessage = "The starting date of the report, in RFC 3339 standard ('1970-01-01T00:00:00Z'). If only the end date is added, the start date by default will be the end date minus 7 days." + )] + [ValidateNotNullOrEmpty()] + [string]$startDate, + [Parameter( + HelpMessage = "The end date of the report, in RFC 3339 standard ('1970-01-01T00:00:00Z'). The default is the current time." + )] + [ValidateNotNullOrEmpty()] + [string]$endDate + ) + + $filter = Get-ZertoApiFilter -FilterTable $PSBoundParameters + $uri = "reports/account-rpo-average{0}" -f $filter + Invoke-ZARestRequest -uri $uri +} diff --git a/ZertoApiWrapper/Public/Get-ZARPOAverage.ps1 b/ZertoApiWrapper/Public/Get-ZARPOAverage.ps1 new file mode 100644 index 0000000..2114c85 --- /dev/null +++ b/ZertoApiWrapper/Public/Get-ZARPOAverage.ps1 @@ -0,0 +1,31 @@ +<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #> +function Get-ZARPOAverage { + [CmdletBinding()] + param ( + [Parameter( + Helpmessage = "The identifier of the VPG.", + Mandatory + )] + [ValidateNotNullOrEmpty()] + [string]$vpgIdentifier, + [Parameter( + HelpMessage = "The starting date of the report, in RFC 3339 standard ('1970-01-01T00:00:00Z'). If only the end date is added, the start date by default will be the end date minus 7 days." + )] + [ValidateNotNullOrEmpty()] + [string]$startDate, + [Parameter( + HelpMessage = "The end date of the report, in RFC 3339 standard ('1970-01-01T00:00:00Z'). The default is the current time." + )] + [ValidateNotNullOrEmpty()] + [string]$endDate, + [Parameter( + HelpMessage = "The interval selected within the duration of the report. The interval can be 1-minute data granularity for up to 6 hours’ time frame, 1-hour data granularity for 6 hours to 15 days’ time frame or 1-day data granularity for 15 days up to 30 days’ time frame. Value should be submitted in Seconds" + )] + [ValidateRange(60, 2678400)] + [Int32]$interval + ) + + $filter = Get-ZertoApiFilter -FilterTable $PSBoundParameters + $uri = "reports/rpo-average{0}" -f $filter + Invoke-ZARestRequest -uri $uri +} diff --git a/ZertoApiWrapper/Public/Get-ZARPOBreach.ps1 b/ZertoApiWrapper/Public/Get-ZARPOBreach.ps1 new file mode 100644 index 0000000..3030cca --- /dev/null +++ b/ZertoApiWrapper/Public/Get-ZARPOBreach.ps1 @@ -0,0 +1,26 @@ +<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #> +function Get-ZARPOBreach { + [CmdletBinding()] + param ( + [Parameter( + HelpMessage = "The identifier of the VPG.", + Mandatory + )] + [ValidateNotNullOrEmpty()] + [string]$vpgIdentifier, + [Parameter( + HelpMessage = "The starting date of the report, in RFC 3339 standard ('1970-01-01T00:00:00Z'). If only the end date is added, the start date by default will be the end date minus 7 days." + )] + [ValidateNotNullOrEmpty()] + [string]$startDate, + [Parameter( + HelpMessage = "The end date of the report, in RFC 3339 standard ('1970-01-01T00:00:00Z'). The default is the current time." + )] + [ValidateNotNullOrEmpty()] + [string]$endDate + ) + + $filter = Get-ZertoApiFilter -FilterTable $PSBoundParameters + $uri = "reports/rpo-breach{0}" -f $filter + Invoke-ZARestRequest -uri $uri +} diff --git a/ZertoApiWrapper/Public/Get-ZARPOStat.ps1 b/ZertoApiWrapper/Public/Get-ZARPOStat.ps1 new file mode 100644 index 0000000..14f9a29 --- /dev/null +++ b/ZertoApiWrapper/Public/Get-ZARPOStat.ps1 @@ -0,0 +1,26 @@ +<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #> +function Get-ZARPOStat { + [CmdletBinding()] + param ( + [Parameter( + HelpMessage = "The identifier of the VPG.", + Mandatory + )] + [ValidateNotNullOrEmpty()] + [string]$vpgIdentifier, + [Parameter( + HelpMessage = "The starting date of the report, in RFC 3339 standard ('1970-01-01T00:00:00Z'). If only the end date is added, the start date by default will be the end date minus 7 days." + )] + [ValidateNotNullOrEmpty()] + [string]$startDate, + [Parameter( + HelpMessage = "The end date of the report, in RFC 3339 standard ('1970-01-01T00:00:00Z'). The default is the current time." + )] + [ValidateNotNullOrEmpty()] + [string]$endDate + ) + + $filter = Get-ZertoApiFilter -FilterTable $PSBoundParameters + $uri = "reports/stats-rpo{0}" -f $filter + Invoke-ZARestRequest -uri $uri +} diff --git a/ZertoApiWrapper/Public/Get-ZARPOStatusProportion.ps1 b/ZertoApiWrapper/Public/Get-ZARPOStatusProportion.ps1 new file mode 100644 index 0000000..493d7f7 --- /dev/null +++ b/ZertoApiWrapper/Public/Get-ZARPOStatusProportion.ps1 @@ -0,0 +1,26 @@ +<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #> +function Get-ZARPOStatusProportion { + [CmdletBinding()] + param ( + [Parameter( + HelpMessage = "The identifier of the VPG.", + Mandatory + )] + [ValidateNotNullOrEmpty()] + [string]$vpgIdentifier, + [Parameter( + HelpMessage = "The starting date of the report, in RFC 3339 standard ('1970-01-01T00:00:00Z'). If only the end date is added, the start date by default will be the end date minus 7 days." + )] + [ValidateNotNullOrEmpty()] + [string]$startDate, + [Parameter( + HelpMessage = "The end date of the report, in RFC 3339 standard ('1970-01-01T00:00:00Z'). The default is the current time." + )] + [ValidateNotNullOrEmpty()] + [string]$endDate + ) + + $filter = Get-ZertoApiFilter -FilterTable $PSBoundParameters + $uri = "reports/rpo-statuses-proportions{0}" -f $filter + Invoke-ZARestRequest -uri $uri +} diff --git a/ZertoApiWrapper/Public/Get-ZARPOSummary.ps1 b/ZertoApiWrapper/Public/Get-ZARPOSummary.ps1 new file mode 100644 index 0000000..58f3a61 --- /dev/null +++ b/ZertoApiWrapper/Public/Get-ZARPOSummary.ps1 @@ -0,0 +1,26 @@ +<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #> +function Get-ZARPOSummary { + [CmdletBinding()] + param ( + [Parameter( + HelpMessage = "The identifier of the VPG.", + Mandatory + )] + [ValidateNotNullOrEmpty()] + [string]$vpgIdentifier, + [Parameter( + HelpMessage = "The starting date of the report, in RFC 3339 standard ('1970-01-01T00:00:00Z'). If only the end date is added, the start date by default will be the end date minus 7 days." + )] + [ValidateNotNullOrEmpty()] + [string]$startDate, + [Parameter( + HelpMessage = "The end date of the report, in RFC 3339 standard ('1970-01-01T00:00:00Z'). The default is the current time." + )] + [ValidateNotNullOrEmpty()] + [string]$endDate + ) + + $filter = Get-ZertoApiFilter -FilterTable $PSBoundParameters + $uri = "reports/rpo-summary{0}" -f $filter + Invoke-ZARestRequest -uri $uri +} diff --git a/ZertoApiWrapper/Public/Get-ZASite.ps1 b/ZertoApiWrapper/Public/Get-ZASite.ps1 new file mode 100644 index 0000000..dc2b66d --- /dev/null +++ b/ZertoApiWrapper/Public/Get-ZASite.ps1 @@ -0,0 +1,18 @@ +<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #> +function Get-ZASite { + [cmdletbinding()] + param( + [Parameter( + HelpMessage = "The ZORG identifier by which to filter site list. If the ZORG identifier is omitted, a list of all sites is retrieved." + )] + [ValidateNotNullOrEmpty()] + [string]$zOrgIdentifier + ) + $uri = "monitoring/sites" + if ( -not [String]::IsNullorEmpty($zOrgIdentifier) ) { + $filterTable = @{"zOrgIdentifier" = $zOrgIdentifier } + $filterString = Get-ZertoApiFilter -filterTable $filterTable + $uri = "{0}{1}" -f $uri, $filterString + } + Invoke-ZARestRequest -uri $uri +} diff --git a/ZertoApiWrapper/Public/Get-ZASitePair.ps1 b/ZertoApiWrapper/Public/Get-ZASitePair.ps1 new file mode 100644 index 0000000..1c3d724 --- /dev/null +++ b/ZertoApiWrapper/Public/Get-ZASitePair.ps1 @@ -0,0 +1,24 @@ +<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #> +function Get-ZASitePair { + [cmdletbinding()] + param( + [Parameter( + HelpMessage = "The ZORG identifier by which to filter the site list. If the ZORG identifier is omitted, a list of all sites is retrieved." + )] + [ValidateNotNullOrEmpty()] + [string]$zOrgIdentifier, + [Parameter( + HelpMessage = "Start date in RFC 3339 standard ('1970-01-01T00:00:00Z'). If the start date is omitted, the default start date is 7 days before the end date." + )] + [ValidateNotNullOrEmpty()] + [string]$startDate, + [Parameter( + HelpMessage = "End date in RFC 3339 standard ('1970-01-01T00:00:00Z'). If the end date is omitted, the default endDate is the current date." + )] + [ValidateNotNullOrEmpty()] + [string]$endDate + ) + $filter = Get-ZertoApiFilter -filterTable $PSBoundParameters + $uri = "reports/sites-list{0}" -f $filter + Invoke-ZARestRequest -uri $uri +} diff --git a/ZertoApiWrapper/Public/Get-ZASiteTopology.ps1 b/ZertoApiWrapper/Public/Get-ZASiteTopology.ps1 new file mode 100644 index 0000000..82795c3 --- /dev/null +++ b/ZertoApiWrapper/Public/Get-ZASiteTopology.ps1 @@ -0,0 +1,20 @@ +<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #> +function Get-ZASiteTopology { + [cmdletbinding()] + param( + [Parameter( + HelpMessage = "The ZORG identifier by which to filter sites topology list. If the ZORG identifier is omitted, information related to all sites topology is retrieved." + )] + [ValidateNotNullOrEmpty()] + [string]$zOrgIdentifier + ) + $uri = "monitoring/sites" + if ( -not [String]::IsNullorEmpty($zOrgIdentifier) ) { + $filterTable = @{"zOrgIdentifier" = $zOrgIdentifier } + $filterString = Get-ZertoApiFilter -filterTable $filterTable + $uri = "{0}{1}&format=topology" -f $uri, $filterString + } else { + $uri = "{0}?format=topology" -f $uri + } + Invoke-ZARestRequest -uri $uri +} diff --git a/ZertoApiWrapper/Public/Get-ZATask.ps1 b/ZertoApiWrapper/Public/Get-ZATask.ps1 new file mode 100644 index 0000000..d13ebb3 --- /dev/null +++ b/ZertoApiWrapper/Public/Get-ZATask.ps1 @@ -0,0 +1,39 @@ +<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #> +function Get-ZATask { + [cmdletbinding( DefaultParameterSetName = "zOrg")] + param( + [Parameter( + HelpMessage = "The ZORG identifier by which to filter the task list. If the ZORG identifier is omitted, a list of all the tasks is retrieved.", + ParameterSetName = "zOrg" + )] + [ValidateNotNullOrEmpty()] + [string]$zOrgIdentifier, + [Parameter( + HelpMessage = "The maximum number of tasks to return.", + ParameterSetName = "zOrg" + )] + [ValidateRange(1, 1000000)] + [int]$limitTo, + [Parameter( + HelpMessage = "The task Idnetifier", + ParameterSetName = "taskId", + Mandatory + )] + [ValidateNotNullOrEmpty()] + [string]$taskIdentifier + ) + $uri = "monitoring/tasks" + switch ($PSCmdlet.ParameterSetName) { + zOrg { + if ( $PSBoundParameters.Keys.Count -gt 0 ) { + $filterString = Get-ZertoApiFilter -filterTable $PSBoundParameters + $uri = "{0}{1}" -f $uri, $filterString + } + } + + taskId { + $uri = "{0}/{1}" -f $uri, $taskIdentifier + } + } + Invoke-ZARestRequest -uri $uri +} diff --git a/ZertoApiWrapper/Public/Get-ZAVolume.ps1 b/ZertoApiWrapper/Public/Get-ZAVolume.ps1 new file mode 100644 index 0000000..662448e --- /dev/null +++ b/ZertoApiWrapper/Public/Get-ZAVolume.ps1 @@ -0,0 +1,44 @@ +<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #> +function Get-ZAVolume { + [CmdletBinding(DefaultParameterSetName = "VpgIdentifier")] + param ( + [Parameter( + HelpMessage = "The site identifier. The site identifier is mandatory if vpgIdentifier is not entered.", + Mandatory, + ParameterSetName = "SiteAndClusterIdentifier" + )] + [Parameter( + HelpMessage = "The site identifier. The site identifier is mandatory if vpgIdentifier is not entered.", + Mandatory, + ParameterSetName = "SiteAndDatastoreIdentifier" + )] + [ValidateNotNullOrEmpty()] + [string]$siteIdentifier, + [Parameter( + HelpMessage = "The cluster identifier. If a cluster identifier is not entered, you must enter a datastore identifier.", + Mandatory, + ParameterSetName = "SiteAndClusterIdentifier" + )] + [ValidateNotNullOrEmpty()] + [string]$clusterIdentifier, + [Parameter( + HelpMessage = "The datastore identifer. If a datastore identifier is not entered, you must enter a cluster identifier.", + Mandatory, + ParameterSetName = "SiteAndDatastoreIdentifier" + )] + [ValidateNotNullOrEmpty()] + [string]$datastoreIdentifier, + [Parameter( + HelpMessage = "The vpg identifer.", + Mandatory, + ParameterSetName = "VpgIdentifier" + )] + [ValidateNotNullOrEmpty()] + [string]$vpgIdentifier + + ) + + $filter = Get-ZertoApiFilter -FilterTable $PSBoundParameters + $uri = "monitoring/volumes{0}" -f $filter + Invoke-ZARestRequest -uri $uri +} diff --git a/ZertoApiWrapper/Public/Get-ZAVpg.ps1 b/ZertoApiWrapper/Public/Get-ZAVpg.ps1 new file mode 100644 index 0000000..bb50cb8 --- /dev/null +++ b/ZertoApiWrapper/Public/Get-ZAVpg.ps1 @@ -0,0 +1,36 @@ +<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #> +function Get-ZAVpg { + [cmdletbinding(DefaultParameterSetName = 'zOrg')] + param( + [Parameter( + HelpMessage = "The ZORG identifier by which to filter the VPG list. If the ZORG identifier is omitted, a list of all VPGs is retrieved.", + ParameterSetName = 'zOrg' + )] + [ValidateNotNullOrEmpty()] + [string]$zOrgIdentifier, + [Parameter( + HelpMessage = "The VPG Identifier", + ParameterSetName = "vpg", + Mandatory + )] + [ValidateNotNullOrEmpty()] + [string]$vpgIdentifier + ) + $uri = "monitoring/vpgs" + + switch ($PSCmdlet.ParameterSetName) { + zOrg { + if ( -not [String]::IsNullorEmpty($zOrgIdentifier) ) { + $filterTable = @{"zOrgIdentifier" = $zOrgIdentifier } + $filterString = Get-ZertoApiFilter -filterTable $filterTable + $uri = "{0}{1}" -f $uri, $filterString + } + } + + vpg { + $uri = "{0}/$vpgIdentifier" -f $uri + } + } + + Invoke-ZARestRequest -uri $uri +} diff --git a/ZertoApiWrapper/Public/Get-ZAzOrg.ps1 b/ZertoApiWrapper/Public/Get-ZAzOrg.ps1 new file mode 100644 index 0000000..7a69bc1 --- /dev/null +++ b/ZertoApiWrapper/Public/Get-ZAzOrg.ps1 @@ -0,0 +1,7 @@ +<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #> +function Get-ZAzOrg { + [cmdletbinding()] + param() + $uri = "monitoring/zorgs" + Invoke-ZARestRequest -uri $uri +} \ No newline at end of file diff --git a/ZertoApiWrapper/Public/Get-ZertoAlert.ps1 b/ZertoApiWrapper/Public/Get-ZertoAlert.ps1 index 1ee27f6..d9d9181 100644 --- a/ZertoApiWrapper/Public/Get-ZertoAlert.ps1 +++ b/ZertoApiWrapper/Public/Get-ZertoAlert.ps1 @@ -4,7 +4,7 @@ function Get-ZertoAlert { param( [Parameter( ParameterSetName = "alertId", - Mandatory = $true, + Mandatory, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true , HelpMessage = "AlertId or array of AlertIds to be queried" @@ -13,19 +13,19 @@ function Get-ZertoAlert { [string[]]$alertId, [Parameter( ParameterSetName = "entities", - Mandatory = $true, + Mandatory, HelpMessage = "Switch to return the entities information from the API" )] [switch]$entities, [Parameter( ParameterSetName = "helpIdentifiers", - Mandatory = $true, + Mandatory, HelpMessage = "Switch to get the Help Identifiers information from the API" )] [switch]$helpIdentifiers, [Parameter( ParameterSetName = "levels", - Mandatory = $true, + Mandatory, HelpMessage = "Switch to return Alert Levels information from the API" )] [switch]$levels, @@ -43,7 +43,7 @@ function Get-ZertoAlert { [string]$endDate, [Parameter( ParameterSetName = "filter", - HelpMessage = "Returns alerts for the specified vraIdentifier" + HelpMessage = "Returns alerts for the specified vpgIdentifier" )] [ValidateNotNullOrEmpty()] [Alias("vpgId")] diff --git a/ZertoApiWrapper/Public/Get-ZertoEvent.ps1 b/ZertoApiWrapper/Public/Get-ZertoEvent.ps1 index 1c45ee8..3f49004 100644 --- a/ZertoApiWrapper/Public/Get-ZertoEvent.ps1 +++ b/ZertoApiWrapper/Public/Get-ZertoEvent.ps1 @@ -69,7 +69,7 @@ function Get-ZertoEvent { ParameterSetName = "filter", HelpMessage = "The type of event to return. This filter behaves in the same way as the eventCategory filter. Possible Values are: Possible Values are: 'All', 'Events', 'Alerts'" )] - [ValidateNotNullOrEmpty()] + [ValidateSet('All', 'Events', 'Alerts')] [string]$category, [Parameter( ParameterSetName = "filter", @@ -86,7 +86,7 @@ function Get-ZertoEvent { [string]$alertIdentifier, [Parameter( ParameterSetName = "eventId", - Mandatory = $true, + Mandatory, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, HelpMessage = "The identifier or identifiers of the event for which information is returned." @@ -95,19 +95,19 @@ function Get-ZertoEvent { [string[]]$eventId, [Parameter( ParameterSetName = "categories", - Mandatory = $true, + Mandatory, HelpMessage = "Returns possible Event Categories." )] [switch]$categories, [Parameter( ParameterSetName = "entities", - Mandatory = $true, + Mandatory, HelpMessage = "Returns possible entity types." )] [switch]$entities, [Parameter( ParameterSetName = "types", - Mandatory = $true, + Mandatory, HelpMessage = "Returns possible event types.")] [switch]$types ) @@ -137,6 +137,10 @@ function Get-ZertoEvent { # If a filter is applied, create the filter and return the events that fall in that filter "filter" { $filter = Get-ZertoApiFilter -filterTable $PSBoundParameters + if ($PSBoundParameters.Keys -contains 'vpg') { + $vpgIdentifier = (Get-ZertoVpg -name $vpg).vpgIdentifier + $filter = $filter.replace("vpg=$vpg", "vpg=$vpgIdentifier") + } $uri = "{0}{1}" -f $baseUri, $filter $returnObject = Invoke-ZertoRestRequest -uri $uri } diff --git a/ZertoApiWrapper/Public/Get-ZertoPeerSite.ps1 b/ZertoApiWrapper/Public/Get-ZertoPeerSite.ps1 index 8f64673..d5c42e3 100644 --- a/ZertoApiWrapper/Public/Get-ZertoPeerSite.ps1 +++ b/ZertoApiWrapper/Public/Get-ZertoPeerSite.ps1 @@ -5,12 +5,12 @@ function Get-ZertoPeerSite { [Parameter( ParameterSetName = "pairingStatuses", HelpMessage = "Switch to return possible paiting statuses.", - Mandatory = $true + Mandatory )] [switch]$pairingStatuses, [Parameter( ParameterSetName = "siteIdentifier", - Mandatory = $true, + Mandatory, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, HelpMessage = "The identifier(s) of the peer site(s) for which information is to be returned." @@ -22,6 +22,7 @@ function Get-ZertoPeerSite { ParameterSetName = "filter", HelpMessage = "The name of a peer site for which information is to be returned. The name is case-sensitive." )] + [ValidateNotNullOrEmpty()] [string]$peerName, [Parameter ( ParameterSetName = "filter", diff --git a/ZertoApiWrapper/Public/Get-ZertoProtectedVm.ps1 b/ZertoApiWrapper/Public/Get-ZertoProtectedVm.ps1 index 36dc2aa..e559926 100644 --- a/ZertoApiWrapper/Public/Get-ZertoProtectedVm.ps1 +++ b/ZertoApiWrapper/Public/Get-ZertoProtectedVm.ps1 @@ -4,7 +4,7 @@ function Get-ZertoProtectedVm { param ( [Parameter( ParameterSetName = "vmIdentifier", - Mandatory = $true, + Mandatory, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, HelpMessage = "vmIdentifier(s) for which to return information" diff --git a/ZertoApiWrapper/Public/Get-ZertoRecoveryReport.ps1 b/ZertoApiWrapper/Public/Get-ZertoRecoveryReport.ps1 index c15ba9c..fded034 100644 --- a/ZertoApiWrapper/Public/Get-ZertoRecoveryReport.ps1 +++ b/ZertoApiWrapper/Public/Get-ZertoRecoveryReport.ps1 @@ -26,12 +26,6 @@ function Get-ZertoRecoveryReport { )] [ValidateNotNullOrEmpty()] [string]$pageSize, - [Parameter( - ParameterSetName = "filter", - HelpMessage = "The internal identifier of the VPG. You can specify more than one VPG, separated by commas." - )] - [ValidateNotNullOrEmpty()] - [string]$vpgIdentifier, [Parameter( ParameterSetName = "filter", HelpMessage = "The name of the VPG. You can specify more than one VPG, separated by commas." diff --git a/ZertoApiWrapper/Public/Get-ZertoUnprotectedVm.ps1 b/ZertoApiWrapper/Public/Get-ZertoUnprotectedVm.ps1 index d76e96c..68a20f4 100644 --- a/ZertoApiWrapper/Public/Get-ZertoUnprotectedVm.ps1 +++ b/ZertoApiWrapper/Public/Get-ZertoUnprotectedVm.ps1 @@ -2,6 +2,6 @@ function Get-ZertoUnprotectedVm { [cmdletbinding()] param() - $uri = "virtualizationsites/{0}/vms" -f $script:zvmLocalInfo.siteidentifier + $uri = "virtualizationsites/{0}/vms" -f (Get-ZertoLocalSite).siteIdentifier Invoke-ZertoRestRequest -uri $uri } diff --git a/ZertoApiWrapper/Public/Get-ZertoVirtualizationSite.ps1 b/ZertoApiWrapper/Public/Get-ZertoVirtualizationSite.ps1 index e296887..ddaaf20 100644 --- a/ZertoApiWrapper/Public/Get-ZertoVirtualizationSite.ps1 +++ b/ZertoApiWrapper/Public/Get-ZertoVirtualizationSite.ps1 @@ -4,52 +4,57 @@ function Get-ZertoVirtualizationSite { param( [Parameter( ParameterSetName = "siteIdentifier", - Mandatory = $true, + Mandatory, HelpMessage = "The identifier of the Zerto Virtual Manager site." )] [Parameter( ParameterSetName = "datastoreClusters", - Mandatory = $true, + Mandatory, HelpMessage = "The identifier of the Zerto Virtual Manager site." )] [Parameter( ParameterSetName = "datastores", - Mandatory = $true, + Mandatory, HelpMessage = "The identifier of the Zerto Virtual Manager site." )] [Parameter( ParameterSetName = "hostClusters", - Mandatory = $true, + Mandatory, HelpMessage = "The identifier of the Zerto Virtual Manager site." )] [Parameter( ParameterSetName = "hosts", - Mandatory = $true, + Mandatory, HelpMessage = "The identifier of the Zerto Virtual Manager site." )] [Parameter( ParameterSetName = "networks", - Mandatory = $true, + Mandatory, HelpMessage = "The identifier of the Zerto Virtual Manager site." )] [Parameter( ParameterSetName = "resourcePools", - Mandatory = $true, + Mandatory, HelpMessage = "The identifier of the Zerto Virtual Manager site." )] [Parameter( ParameterSetName = "vms", - Mandatory = $true, + Mandatory, HelpMessage = "The identifier of the Zerto Virtual Manager site." )] [Parameter( ParameterSetName = "devices", - Mandatory = $true, + Mandatory, HelpMessage = "The identifier of the Zerto Virtual Manager site." )] [Parameter( ParameterSetName = "folders", - Mandatory = $true, + Mandatory, + HelpMessage = "The identifier of the Zerto Virtual Manager site." + )] + [Parameter( + ParameterSetName = "repositories", + Mandatory, HelpMessage = "The identifier of the Zerto Virtual Manager site." )] [ValidateNotNullOrEmpty()] @@ -57,19 +62,19 @@ function Get-ZertoVirtualizationSite { [string]$siteIdentifier, [Parameter( ParameterSetName = "datastoreClusters", - Mandatory = $true, + Mandatory, HelpMessage = "When selected, will return all datastore clusters at the specified site." )] [switch]$datastoreClusters, [Parameter( ParameterSetName = "datastores", - Mandatory = $true, + Mandatory, HelpMessage = "When selected, will return all datastores at the specified site." )] [switch]$datastores, [Parameter( ParameterSetName = "devices", - Mandatory = $true, + Mandatory, HelpMessage = "When selected, will return all devices at the specified site." )] [switch]$devices, @@ -88,66 +93,67 @@ function Get-ZertoVirtualizationSite { [string]$hostIdentifier, [Parameter( ParameterSetName = "folders", - Mandatory = $true, + Mandatory, HelpMessage = "Return all folders at the selected site." )] [switch]$folders, [Parameter( ParameterSetName = "hostClusters", - Mandatory = $true, + Mandatory, HelpMessage = "Return all host clusters at the selected site." )] [switch]$hostClusters, [Parameter( ParameterSetName = "hosts", - Mandatory = $true, + Mandatory, HelpMessage = "Return all hosts at the selected site. If a host identifier is provided, return only that host." )] [switch]$hosts, [Parameter( ParameterSetName = "networks", - Mandatory = $true, + Mandatory, HelpMessage = "Return all networks at the selected site." )] [switch]$networks, [Parameter( ParameterSetName = "resourcePools", - Mandatory = $true, + Mandatory, HelpMessage = "Return all resource pools at the selected site." )] [switch]$resourcePools, [Parameter( ParameterSetName = "vms", - Mandatory = $true, + Mandatory, HelpMessage = "Return all VMs at the selected site." )] - [switch]$vms + [switch]$vms, + [Parameter( + ParameterSetName = "repositories", + Mandatory, + HelpMessage = "The identifier of the Zerto Virtual Manager site." + )] + [switch]$repositories ) begin { - $baseUri = "virtualizationsites" - $returnObject = @() + } process { # Return information based on ParameterSetName invoked. + $baseUri = "virtualizationsites" switch ( $PSCmdlet.ParameterSetName ) { - # If no ParameterSetName is specified, return all data "main" { - $returnObject = Invoke-ZertoRestRequest -uri $baseUri + $uri = $baseUri } # If devices is specified along with a hostId, build return just that host information, otherwise return all devices at the site - #TODO - remove foreach, only one siteIdentifier can be specified. "devices" { - $returnObject = foreach ( $id in $siteIdentifier ) { - if ( $PSBoundParameters.ContainsKey( "hostIdentifier" ) ) { - $uri = "{0}/{1}/devices?hostIdentifier={2}" -f $baseUri, $siteIdentifier, $hostIdentifier - } else { - $uri = "{0}/{1}/devices" -f $baseUri, $siteIdentifier - } - Invoke-ZertoRestRequest -uri $uri + if ( $PSBoundParameters.ContainsKey( "hostIdentifier" ) ) { + $uri = "{0}/{1}/devices?hostIdentifier={2}" -f $baseUri, $siteIdentifier, $hostIdentifier + } else { + $uri = "{0}/{1}/devices" -f $baseUri, $siteIdentifier } } @@ -158,24 +164,22 @@ function Get-ZertoVirtualizationSite { } else { $uri = "{0}/{1}/hosts" -f $baseUri, $siteIdentifier } - $returnObject = Invoke-ZertoRestRequest -uri $uri } # If siteIdentifier is specified, return information for that site. "siteIdentifier" { $uri = "{0}/{1}" -f $baseUri, $siteIdentifier - $returnObject = Invoke-ZertoRestRequest -uri $uri } # If a different ParameterSetName is selected, use that information to build the URI and return that information default { $uri = "{0}/{1}/{2}" -f $baseUri, $siteIdentifier, $PSCmdlet.ParameterSetName.ToLower() - $returnObject = Invoke-ZertoRestRequest -uri $uri } } + Invoke-ZertoRestRequest -uri $uri } end { - return $returnObject + } } diff --git a/ZertoApiWrapper/Public/Get-ZertoVpg.ps1 b/ZertoApiWrapper/Public/Get-ZertoVpg.ps1 index d151152..c26a968 100644 --- a/ZertoApiWrapper/Public/Get-ZertoVpg.ps1 +++ b/ZertoApiWrapper/Public/Get-ZertoVpg.ps1 @@ -4,17 +4,17 @@ function Get-ZertoVpg { param( [Parameter( ParameterSetName = "protectionGroupIdentifier", - Mandatory = $true, + Mandatory, HelpMessage = "The identifier(s) of the Virtual Protection Group to return" )] [Parameter( ParameterSetName = "checkpoints", - Mandatory = $true, + Mandatory, HelpMessage = "The identifier(s) of the Virtual Protection Group to return" )] [Parameter( ParameterSetName = "stats", - Mandatory = $true, + Mandatory, HelpMessage = "The identifier(s) of the Virtual Protection Group to return" )] [ValidateNotNullOrEmpty()] @@ -22,7 +22,7 @@ function Get-ZertoVpg { [string[]]$protectionGroupIdentifier, [Parameter( ParameterSetName = "checkpoints", - Mandatory = $true, + Mandatory, HelpMessage = "Return checkpoints for the selected Virtual Protection Group." )] [switch]$checkpoints, @@ -39,49 +39,49 @@ function Get-ZertoVpg { [ValidateNotNullOrEmpty()] [string]$endDate, [Parameter( - ParameterSetName = "stats", Mandatory = $true, + ParameterSetName = "stats", Mandatory, HelpMessage = "Return earliest and latest checkpoints for the selected Virtual Protection Group" )] [switch]$checkpointsStats, [Parameter( ParameterSetName = "entityTypes", - Mandatory = $true, + Mandatory, HelpMessage = "Return Valid VPG entityTypes" )] [switch]$entityTypes, [Parameter( ParameterSetName = "failoverCommitPolicies", - Mandatory = $true, + Mandatory, HelpMessage = "Valid Failover Commit Policies" )] [switch]$failoverCommitPolicies, [Parameter( ParameterSetName = "failoverShutdownPolicies", - Mandatory = $true, + Mandatory, HelpMessage = "Valid Failover Shutdown Policies" )] [switch]$failoverShutdownPolicies, [Parameter( ParameterSetName = "priorities", - Mandatory = $true, + Mandatory, HelpMessage = "Valid VPG priorities" )] [switch]$priorities, [Parameter( ParameterSetName = "retentionPolicies", - Mandatory = $true, + Mandatory, HelpMessage = "Valid retention policies" )] [switch]$retentionPolicies, [Parameter( ParameterSetName = "statuses", - Mandatory = $true, + Mandatory, HelpMessage = "Valid VPG statuses" )] [switch]$statuses, [Parameter( ParameterSetName = "subStatuses", - Mandatory = $true, + Mandatory, HelpMessage = "Valid VPG sub statuses" )] [switch]$subStatuses, @@ -160,7 +160,6 @@ function Get-ZertoVpg { ) begin { $baseUri = "vpgs" - $returnObject = @() } Process { @@ -169,14 +168,13 @@ function Get-ZertoVpg { # When called with no parameters, return all values "main" { - $returnObject = Invoke-ZertoRestRequest -uri $baseUri + $uri = $baseUri } # When called with protectionGroupIdentifier, query for each id provided "protectionGroupIdentifier" { - $returnObject = foreach ( $vpgId in $protectionGroupIdentifier ) { - $uri = "{0}/{1}" -f $baseUri, $vpgId - Invoke-ZertoRestRequest -uri $uri + $uri = foreach ( $vpgId in $protectionGroupIdentifier ) { + "{0}/{1}" -f $baseUri, $vpgId } } @@ -185,7 +183,7 @@ function Get-ZertoVpg { $filter = $false if ( $PSBoundParameters.ContainsKey("startDate") -or $PSBoundParameters.ContainsKey("endDate") ) { $filter = $true - $filterTable = @{} + $filterTable = @{ } foreach ( $param in $PSBoundParameters.GetEnumerator() ) { if ( $param.key -eq "startDate" -or $param.key -eq "endDate") { $filterTable[$param.key] = $param.value @@ -193,21 +191,19 @@ function Get-ZertoVpg { } $filter = Get-ZertoApiFilter -filterTable $filterTable } - $returnObject = foreach ( $id in $protectionGroupIdentifier ) { + $uri = foreach ( $id in $protectionGroupIdentifier ) { if ( $filter ) { - $uri = "{0}/{1}/checkpoints{2}" -f $baseUri, $id, $filter + "{0}/{1}/checkpoints{2}" -f $baseUri, $id, $filter } else { - $uri = "{0}/{1}/checkpoints" -f $baseUri, $id + "{0}/{1}/checkpoints" -f $baseUri, $id } - Invoke-ZertoRestRequest -uri $uri } } # When stats are requested "stats" { - $returnObject = foreach ( $id in $protectionGroupIdentifier ) { - $uri = "{0}/{1}/checkpoints/stats" -f $baseUri, $id - Invoke-ZertoRestRequest -uri $uri + $uri = foreach ( $id in $protectionGroupIdentifier ) { + "{0}/{1}/checkpoints/stats" -f $baseUri, $id } } @@ -215,18 +211,18 @@ function Get-ZertoVpg { "filter" { $filter = Get-ZertoApiFilter -filterTable $PSBoundParameters $uri = "{0}{1}" -f $baseUri, $filter - $returnObject = Invoke-ZertoRestRequest -uri $uri } # Default is to build URI based on ParameterSetName and return results. default { $uri = "{0}/{1}" -f $baseUri, $PSCmdlet.ParameterSetName.ToLower() - $returnObject = Invoke-ZertoRestRequest -uri $uri } } + foreach ($entry in $uri) { + Invoke-ZertoRestRequest -uri $entry + } } End { - return $returnObject } } diff --git a/ZertoApiWrapper/Public/Get-ZertoVpgSetting.ps1 b/ZertoApiWrapper/Public/Get-ZertoVpgSetting.ps1 index 39a59e3..13164a1 100644 --- a/ZertoApiWrapper/Public/Get-ZertoVpgSetting.ps1 +++ b/ZertoApiWrapper/Public/Get-ZertoVpgSetting.ps1 @@ -10,7 +10,7 @@ function Get-ZertoVpgSetting { ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, ValueFromRemainingArguments = $true, - Mandatory = $true, + Mandatory, HelpMessage = "The identifier of the VPG settings object for which information is retrieved." )] [Parameter( @@ -18,15 +18,15 @@ function Get-ZertoVpgSetting { ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, ValueFromRemainingArguments = $true, - Mandatory = $true, - HelpMessage = "The identifier of the VPG settings object for which information is retrieved." + Mandatory, + HelpMessage = "The identifier of the VPG settings object for which information is retrieved. Please note, this parameter is ONLY available in Zerto version 7.5 and earlier. Attempting to run this switch against a Zerto Virtual Manager version 8.0 or higher result in an error." )] [Parameter( ParameterSetName = "dayOfWeek", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, ValueFromRemainingArguments = $true, - Mandatory = $true, + Mandatory, HelpMessage = "The identifier of the VPG settings object for which information is retrieved." )] [Parameter( @@ -34,7 +34,7 @@ function Get-ZertoVpgSetting { ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, ValueFromRemainingArguments = $true, - Mandatory = $true, + Mandatory, HelpMessage = "The identifier of the VPG settings object for which information is retrieved." )] [Parameter( @@ -42,7 +42,7 @@ function Get-ZertoVpgSetting { ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, ValueFromRemainingArguments = $true, - Mandatory = $true, + Mandatory, HelpMessage = "The identifier of the VPG settings object for which information is retrieved." )] [Parameter( @@ -50,7 +50,7 @@ function Get-ZertoVpgSetting { ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, ValueFromRemainingArguments = $true, - Mandatory = $true, + Mandatory, HelpMessage = "The identifier of the VPG settings object for which information is retrieved." )] [Parameter( @@ -58,7 +58,7 @@ function Get-ZertoVpgSetting { ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, ValueFromRemainingArguments = $true, - Mandatory = $true, + Mandatory, HelpMessage = "The identifier of the VPG settings object for which information is retrieved." )] [Parameter( @@ -66,7 +66,7 @@ function Get-ZertoVpgSetting { ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, ValueFromRemainingArguments = $true, - Mandatory = $true, + Mandatory, HelpMessage = "The identifier of the VPG settings object for which information is retrieved." )] [Parameter( @@ -74,7 +74,7 @@ function Get-ZertoVpgSetting { ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, ValueFromRemainingArguments = $true, - Mandatory = $true, + Mandatory, HelpMessage = "The identifier of the VPG settings object for which information is retrieved." )] [Parameter( @@ -82,7 +82,7 @@ function Get-ZertoVpgSetting { ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, ValueFromRemainingArguments = $true, - Mandatory = $true, + Mandatory, HelpMessage = "The identifier of the VPG settings object for which information is retrieved." )] [Parameter( @@ -90,7 +90,7 @@ function Get-ZertoVpgSetting { ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, ValueFromRemainingArguments = $true, - Mandatory = $true, + Mandatory, HelpMessage = "The identifier of the VPG settings object for which information is retrieved." )] [Parameter( @@ -98,7 +98,7 @@ function Get-ZertoVpgSetting { ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, ValueFromRemainingArguments = $true, - Mandatory = $true, + Mandatory, HelpMessage = "The identifier of the VPG settings object for which information is retrieved." )] [Parameter( @@ -106,7 +106,7 @@ function Get-ZertoVpgSetting { ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, ValueFromRemainingArguments = $true, - Mandatory = $true, + Mandatory, HelpMessage = "The identifier of the VPG settings object for which information is retrieved." )] [Parameter( @@ -114,7 +114,7 @@ function Get-ZertoVpgSetting { ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, ValueFromRemainingArguments = $true, - Mandatory = $true, + Mandatory, HelpMessage = "The identifier of the VPG settings object for which information is retrieved." )] [Parameter( @@ -122,7 +122,7 @@ function Get-ZertoVpgSetting { ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, ValueFromRemainingArguments = $true, - Mandatory = $true, + Mandatory, HelpMessage = "The identifier of the VPG settings object for which information is retrieved." )] [Parameter( @@ -130,7 +130,7 @@ function Get-ZertoVpgSetting { ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, ValueFromRemainingArguments = $true, - Mandatory = $true, + Mandatory, HelpMessage = "The identifier of the VPG settings object for which information is retrieved." )] [Parameter( @@ -138,7 +138,7 @@ function Get-ZertoVpgSetting { ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, ValueFromRemainingArguments = $true, - Mandatory = $true, + Mandatory, HelpMessage = "The identifier of the VPG settings object for which information is retrieved." )] [Parameter( @@ -146,7 +146,15 @@ function Get-ZertoVpgSetting { ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, ValueFromRemainingArguments = $true, - Mandatory = $true, + Mandatory, + HelpMessage = "The identifier of the VPG settings object for which information is retrieved." + )] + [Parameter( + ParameterSetName = "ltr", + ValueFromPipeline = $true, + ValueFromPipelineByPropertyName = $true, + ValueFromRemainingArguments = $true, + Mandatory, HelpMessage = "The identifier of the VPG settings object for which information is retrieved." )] [ValidateNotNullOrEmpty()] @@ -154,99 +162,100 @@ function Get-ZertoVpgSetting { [string[]]$vpgSettingsIdentifier, [Parameter( ParameterSetName = "backup", - Mandatory = $true, - HelpMessage = "Return backup information for VPG identifier specified" + Mandatory, + HelpMessage = "Return backup information for VPG identifier specified. Please note, this parameter is ONLY available in Zerto version 7.5 and earlier. Attempting to run this switch against a Zerto Virtual Manager version 8.0 or higher result in an error." )] [switch]$backup, [Parameter( ParameterSetName = "dayOfWeek", - Mandatory = $true, - HelpMessage = "Get the day of week a backup is scheduled" + Mandatory, + HelpMessage = "Get the day of week a backup is scheduled. Please note, this parameter is ONLY available in Zerto version 7.5 and earlier. Attempting to run this switch against a Zerto Virtual Manager version 8.0 or higher result in an error." )] [switch]$dayOfWeek, [Parameter( ParameterSetName = "retentionPeriod", - Mandatory = $true, - HelpMessage = "Get the retention period for a backup" + Mandatory, + HelpMessage = "Get the retention period for a backup. Please note, this parameter is ONLY available in Zerto version 7.5 and earlier. Attempting to run this switch against a Zerto Virtual Manager version 8.0 or higher result in an error." )] [switch]$retentionPeriod, [Parameter( ParameterSetName = "schedulerPeriod", - Mandatory = $true, - HelpMessage = "Get the backup schedule" + Mandatory, + HelpMessage = "Get the backup schedule. Please note, this parameter is ONLY available in Zerto version 7.5 and earlier. Attempting to run this switch against a Zerto Virtual Manager version 8.0 or higher result in an error." )] [switch]$schedulerPeriod, [Parameter( ParameterSetName = "basic", - Mandatory = $true, + Mandatory, HelpMessage = "Get VPG Basic Settings" )] [switch]$basic, [Parameter( ParameterSetName = "bootGroup", - Mandatory = $true, + Mandatory, HelpMessage = "Get VPG Boot Settings" )] [switch]$bootgroup, [Parameter( ParameterSetName = "journal", - Mandatory = $true, + Mandatory, HelpMessage = "Get VPG Journal Settings" )] [switch]$journal, [Parameter( ParameterSetName = "networks", - Mandatory = $true, + Mandatory, HelpMessage = "Get VPG Network Settings" )] [switch]$networks, [Parameter( ParameterSetName = "priority", - Mandatory = $true, + Mandatory, HelpMessage = "Get VPG Priority Settings" )] [switch]$priority, [Parameter( ParameterSetName = "recovery", - Mandatory = $true, + Mandatory, HelpMessage = "Get VPG Recovery Settings" )] - [switch]$rcovery, + [Alias("rcovery")] + [switch]$recovery, [Parameter( ParameterSetName = "scripting", - Mandatory = $true, + Mandatory, HelpMessage = "Get VPG Recovery Settings" )] [switch]$scripting, [Parameter( ParameterSetName = "vms", - Mandatory = $true, + Mandatory, HelpMessage = "Get all settings for all VMs in a VPG." )] [switch]$vms, [Parameter( ParameterSetName = "vmIdentifier", - Mandatory = $true, + Mandatory, HelpMessage = "Get all settings for selected VM" )] [Parameter( ParameterSetName = "nics", - Mandatory = $true, + Mandatory, HelpMessage = "VM Identifier" )] [Parameter( ParameterSetName = "volumes", - Mandatory = $true, + Mandatory, HelpMessage = "VM Identifier" )] [Parameter( ParameterSetName = "nicIdentifier", - Mandatory = $true, + Mandatory, HelpMessage = "VM Identifier" )] [Parameter( ParameterSetName = "volumeIdentifier", - Mandatory = $true, + Mandatory, HelpMessage = "VM Identifier" )] [ValidateNotNullOrEmpty()] @@ -254,13 +263,13 @@ function Get-ZertoVpgSetting { [string]$vmIdentifier, [Parameter( ParameterSetName = "nics", - Mandatory = $true, + Mandatory, HelpMessage = "Return NIC information for all NICs of the specified VM" )] [switch]$nics, [Parameter( ParameterSetName = "nicIdentifier", - Mandatory = $true, + Mandatory, HelpMessage = "Return NIC information for specified NIC of the specified VM" )] [ValidateNotNullOrEmpty()] @@ -268,18 +277,25 @@ function Get-ZertoVpgSetting { [string]$nicIdentifier, [Parameter( ParameterSetName = "volumes", - Mandatory = $true, + Mandatory, HelpMessage = "Return Volume information for all volumes of the specified VM" )] [switch]$volumes, [Parameter( ParameterSetName = "volumeIdentifier", - Mandatory = $true, + Mandatory, HelpMessage = "Return volume information for the specified volume of the specified VM" )] [ValidateNotNullOrEmpty()] [Alias("volumeId")] - [string]$volumeIdentifier + [string]$volumeIdentifier, + [Parameter( + ParameterSetName = "ltr", + Mandatory, + HelpMessage = "Return LTR information for the specified VPG. Please note, this parameter is ONLY available in Zerto version 8.0 and later. Attempting to run this switch against a Zerto Virtual Manager version 7.5 or lower will result in an error." + )] + [switch]$ltr + ) begin { diff --git a/ZertoApiWrapper/Public/Import-ZertoVmNicSetting.ps1 b/ZertoApiWrapper/Public/Import-ZertoVmNicSetting.ps1 new file mode 100644 index 0000000..bd9a51d --- /dev/null +++ b/ZertoApiWrapper/Public/Import-ZertoVmNicSetting.ps1 @@ -0,0 +1,124 @@ +<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #> +function Import-ZertoVmNicSetting { + [CmdletBinding(SupportsShouldProcess)] + param( + # File to process for import + [Parameter(Helpmessage = "CSV file containing the required VM NIC settings", Mandatory)] + [ValidateNotNullOrEmpty()] + [string] + $InputFile + ) + + begin { + } + + process { + if (-not (Test-Path $InputFile)) { + Write-Error "Unable to find $InputFile. Please check the name and path and try again." -ErrorAction Stop + } elseif ((Get-Item $InputFile).Extension -notmatch '.csv') { + Write-Error "$InputFile does not have a 'csv' extension. Please check the name and path and try again." -ErrorAction Stop + } + $ExpectedHeaders = "VPGName", "VMName", "NicIdentifier", "LiveNetwork", "LiveShouldReplaceMac", "LiveIsDHCP", "LiveIpAddress", "LiveIpSubnetMask", "LiveIpDefaultGateway", "LivePrimaryDns", "LiveSecondayDns", "LiveDnsSuffix", "TestNetwork", "TestShouldReplaceMac", "TestIsDHCP", "TestIpAddress", "TestIpSubnetMask", "TestIpDefaultGateway", "TestPrimaryDns", "TestSecondayDns", "TestDnsSuffix" + $HeaderLine = ((Get-Content -Path $InputFile -First 1).Replace('"', '')).Split(',') + foreach ($header in $ExpectedHeaders) { + if ($header -notin $HeaderLine) { + Write-Error "$InputFile is malformed. Please ensure all headers are present." -ErrorAction Stop + } + } + $ImportData = Import-Csv -Path $InputFile + $VpgsToUpdate = $ImportData.VPGName | Select-Object -Unique + foreach ($Vpg in $VpgsToUpdate) { + $VpgInfo = Get-ZertoVpg -vpgName $Vpg + $VpgIdentifier = $VpgInfo.VpgIdentifier + $RecoveryNetworks = Get-ZertoVirtualizationSite -siteIdentifier $VpgInfo.RecoverySite.Identifier -networks + $NetworkMap = Get-Map -InputObject $RecoveryNetworks -key "VirtualizationNetworkName" -value "NetworkIdentifier" + $VpgVms = Get-ZertoProtectedVm -vpgName $Vpg + $VmMap = Get-Map -InputObject $VpgVms -key "vmName" -value "vmIdentifier" + $VpgSettingsId = New-ZertoVpgSettingsIdentifier -vpgIdentifier $VpgIdentifier + $VmsToUpdate = $ImportData | Where-Object { $_.VPGName -eq $Vpg } + foreach ($vm in $VmsToUpdate) { + if ([string]::IsNullOrWhiteSpace($vm.VpgName) -or + [string]::IsNullOrWhiteSpace($Vm.VMName) -or + [string]::IsNullOrWhiteSpace($Vm.NicIdentifier) -or + [string]::IsNullOrWhiteSpace($Vm.LiveNetwork) -or + [string]::IsNullOrWhiteSpace($Vm.LiveShouldReplaceMac) -or + [string]::IsNullOrWhiteSpace($Vm.TestNetwork) -or + [string]::IsNullOrWhiteSpace($Vm.TestShouldReplaceMac)) { + Write-Error "$($Vm.VMName) does not contain all the required data. Please check the CSV entry for this item and try again. You are required to provide the VPGName, VMName, NicIdentifier, LiveNetwork, and ShouldReplaceMacAddress for each Nic." -ErrorAction Continue + } else { + $uri = "vpgSettings/{0}/vms/{1}" -f $vpgSettingsId, $vmMap[$vm.VMName] + $VmNicSettings = Get-ZertoVpgSetting -vpgSettingsIdentifier $vpgSettingsId -vmIdentifier $vmMap[$vm.VMName] + foreach ($nic in $VmNicSettings.nics) { + if ($nic.NicIdentifier -eq $vm.NicIdentifier) { + $NicUri = "{0}/nics/{1}" -f $uri, $nic.NicIdentifier + Invoke-ZertoRestRequest -uri $NicUri -Method "DELETE" > $null + $nicSettings = Invoke-ZertoRestRequest -uri $NicUri -Method "GET" + $nicSettings.failover.Hypervisor.NetworkIdentifier = $NetworkMap[$vm.LiveNetwork] + $nicSettings.failover.Hypervisor.ShouldReplaceMacAddress = $vm.LiveShouldReplaceMac + if ($vm.LiveIsDHCP -imatch "true") { + $IpConfig = [PSCustomObject]@{ + IsDhcp = $vm.LiveIsDHCP + PrimaryDns = $vm.LivePrimaryDns + SecondaryDns = $vm.LiveSecondayDns + } + $nicSettings.failover.Hypervisor.IpConfig = $IpConfig + $nicSettings.failover.Hypervisor.DnsSuffix = $vm.LiveDnsSuffix + } elseif (($vm.LiveIsDHCP -imatch "false" -or + [string]::IsNullOrWhiteSpace($vm.LiveIsDHCP)) -and + -not [string]::IsNullOrWhiteSpace($vm.LiveIpAddress)) { + $IpConfig = [PSCustomObject]@{ + IsDhcp = $vm.LiveIsDHCP + StaticIp = $vm.LiveIpAddress + SubnetMask = $vm.LiveIpSubnetMask + Gateway = $vm.LiveIpDefaultGateway + PrimaryDns = $vm.LivePrimaryDns + SecondaryDns = $vm.LiveSecondayDns + } + $nicSettings.failover.Hypervisor.IpConfig = $IpConfig + $nicSettings.failover.Hypervisor.DnsSuffix = $vm.LiveDnsSuffix + } + $nicSettings.failoverTest.Hypervisor.NetworkIdentifier = $NetworkMap[$vm.TestNetwork] + $nicSettings.failoverTest.Hypervisor.ShouldReplaceMacAddress = $vm.TestShouldReplaceMac + if ($vm.TestIsDHCP -imatch "true" ) { + $IpConfig = [PsCustomObject]@{ + IsDhcp = $vm.TestIsDHCP + PrimaryDns = $vm.TestPrimaryDns + SecondaryDns = $vm.TestSecondayDns + } + $nicSettings.failoverTest.Hypervisor.IpConfig = $IpConfig + $nicSettings.failoverTest.Hypervisor.DnsSuffix = $vm.TestDnsSuffix + } elseif (($vm.TestIsDHCP -imatch "false" -or + [string]::IsNullOrWhiteSpace($vm.TestIsDHCP)) -and + -not [string]::IsNullOrWhiteSpace($vm.TestIpAddress)) { + $IpConfig = [PsCustomObject]@{ + IsDhcp = $vm.TestIsDHCP + StaticIp = $vm.TestIpAddress + SubnetMask = $vm.TestIpSubnetMask + Gateway = $vm.TestIpDefaultGateway + PrimaryDns = $vm.TestPrimaryDns + SecondaryDns = $vm.TestSecondayDns + } + $nicSettings.failoverTest.Hypervisor.IpConfig = $IpConfig + $nicSettings.failoverTest.Hypervisor.DnsSuffix = $vm.TestDnsSuffix + } + Write-Verbose "Putting Updated Config for VM: $($vm.name), NIC: $($nic.nicidentifier) in VPG: $Vpg" + if ($PSCmdlet.ShouldProcess($vm.NicIdentifier, "Updating Nic")) { + Invoke-ZertoRestRequest -uri $NicUri -Method "PUT" -Body ($nicSettings | ConvertTo-Json -Depth 10) > $null + } + } + } + } + } + Write-Verbose "Saving updated configuration for VPG: $Vpg" + if ($PSCmdlet.ShouldProcess($Vpg, "Saving Changes")) { + Save-ZertoVpgSetting -vpgSettingsIdentifier $vpgSettingsId + } + Write-Verbose "Waiting 5 Seconds for Next VPG Update" + Start-Sleep 5 + } + } + + + end { + } +} diff --git a/ZertoApiWrapper/Public/Import-ZertoVpg.ps1 b/ZertoApiWrapper/Public/Import-ZertoVpg.ps1 index 48a72cc..30675b9 100644 --- a/ZertoApiWrapper/Public/Import-ZertoVpg.ps1 +++ b/ZertoApiWrapper/Public/Import-ZertoVpg.ps1 @@ -4,7 +4,7 @@ function Import-ZertoVpg { param( [Parameter( HelpMessage = "VPG settings JSON file(s) to import.", - Mandatory = $true, + Mandatory, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true )] diff --git a/ZertoApiWrapper/Public/Install-ZertoVra.ps1 b/ZertoApiWrapper/Public/Install-ZertoVra.ps1 index 2bca65f..3ce61d2 100644 --- a/ZertoApiWrapper/Public/Install-ZertoVra.ps1 +++ b/ZertoApiWrapper/Public/Install-ZertoVra.ps1 @@ -1,72 +1,169 @@ <# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #> -#TODO - Add ability to installed with root password, Move to Begin, Process, End Format function Install-ZertoVra { - [cmdletbinding( SupportsShouldProcess = $true )] + [cmdletbinding( SupportsShouldProcess )] param( - [Parameter( Mandatory = $true, HelpMessage = "Host name where the VRA is to be installed." )] + [Parameter( + Mandatory, + HelpMessage = "Host name where the VRA is to be installed." + )] [ValidateNotNullOrEmpty()] [string]$hostName, - [Parameter( Mandatory = $true, HelpMessage = "Datastore name where the VRA is to be installed." )] + [Parameter( + Mandatory, + HelpMessage = "Datastore name where the VRA is to be installed." + )] [ValidateNotNullOrEmpty()] [string]$datastoreName, - [Parameter( Mandatory = $true, HelpMessage = "Network name the VRA is to be assigned." )] + [Parameter( + Mandatory, + HelpMessage = "Network name the VRA is to be assigned." + )] [ValidateNotNullOrEmpty()] [string]$networkName, - [Parameter( HelpMessage = "Initial amount of memory to assign to the VRA in GB. Default is 3, Minimum is 1, Maximum is 16" )] + [Parameter( + HelpMessage = "Initial amount of memory to assign to the VRA in GB. Default is 3, Minimum is 1, Maximum is 16" + )] [ValidateRange(1, 16)] [int]$memoryInGB = 3, - [Parameter( HelpMessage = "Bandwidth group to assign to the VRA. If unspecified will assign to the 'default_group'" )] + [Parameter( + HelpMessage = "Bandwidth group to assign to the VRA. If unspecified will assign to the 'default_group'" + )] [ValidateNotNullOrEmpty()] [string]$groupName, - [Parameter( ParameterSetName = "Dhcp", Mandatory = $true, HelpMessage = "Assign a DHCP address to the VRA." )] + [Parameter( + ParameterSetName = "Dhcp", + Mandatory, + HelpMessage = "Assign a DHCP address to the VRA." + )] + [Parameter( + ParameterSetName = "DhcpWithRoot", + Mandatory, + HelpMessage = "Assign a DHCP address to the VRA." + )] [switch]$Dhcp, - [Parameter( ParameterSetName = "StaticIp", Mandatory = $true, HelpMessage = "Static IP address to assign to the VRA." )] - [ValidateScript( {$_ -match [IPAddress]$_ })] + [Parameter( + ParameterSetName = "StaticIp", + Mandatory, + HelpMessage = "Static IP address to assign to the VRA." + )] + [Parameter( + ParameterSetName = "StaticIpWithRoot", + Mandatory, + HelpMessage = "Static IP address to assign to the VRA." + )] + [ValidateScript( { $_ -match [IPAddress]$_ })] [string]$vraIpAddress, - [Parameter( ParameterSetName = "StaticIp", Mandatory = $true, HelpMessage = "Default gateway to assign to the VRA" )] - [ValidateScript( {$_ -match [IPAddress]$_ })] + [Parameter( + ParameterSetName = "StaticIp", + Mandatory, + HelpMessage = "Default gateway to assign to the VRA" + )] + [Parameter( + ParameterSetName = "StaticIpWithRoot", + Mandatory, + HelpMessage = "Default gateway to assign to the VRA" + )] + [ValidateScript( { $_ -match [IPAddress]$_ })] [string]$defaultGateway, - [Parameter( ParameterSetName = "StaticIp", Mandatory = $true, HelpMessage = "Subnetmask to be assigned to the VRA" )] - [ValidateScript( {$_ -match [IPAddress]$_ })] - [string]$subnetMask - + [Parameter( + ParameterSetName = "StaticIp", + Mandatory, + HelpMessage = "Subnetmask to be assigned to the VRA" + )] + [Parameter( + ParameterSetName = "StaticIpWithRoot", + Mandatory, + HelpMessage = "Subnetmask to be assigned to the VRA" + )] + [ValidateScript( { $_ -match [IPAddress]$_ })] + [string]$subnetMask, + [Parameter( + ParameterSetName = "StaticIpWithRoot", + Mandatory, + HelpMessage = "Use this switch to install the VRA using the root password install method." + )] + [Parameter( + ParameterSetName = "DhcpWithRoot", + Mandatory, + HelpMessage = "Use this switch to install the VRA using the root password install method." + )] + [switch]$UseRootCredential, + [Parameter( + ParameterSetName = "StaticIpWithRoot", + Mandatory, + HelpMessage = "The password for the root user of the ESXi host where the VRA is to be installed." + )] + [Parameter( + ParameterSetName = "DhcpWithRoot", + Mandatory, + HelpMessage = "The password for the root user of the ESXi host where the VRA is to be installed." + )] + [ValidateNotNullOrEmpty()] + [securestring]$HostRootPassword ) - # Build the VRA Name. - $vraName = "Z-VRA-{0}" -f $hostName - # If the VRA does not exist, proceed with the installation. If it does exist, bypass and - if ( -not (Get-ZertoVra -vraName $vraName) ) { - # Get identifiers for each item provided by name. - $siteIdentifier = $script:zvmLocalInfo.SiteIdentifier - $hostIdentifier = Get-ZertoVirtualizationSite -siteIdentifier $siteIdentifier -hosts | Where-Object {$_.VirtualizationHostName -eq $hostName} | Select-Object hostIdentifier -ExpandProperty hostIdentifier - $networkIdentifier = Get-ZertoVirtualizationSite -siteIdentifier $siteIdentifier -networks | Where-Object {$_.VirtualizationNetworkName -eq $networkName} | Select-Object NetworkIdentifier -ExpandProperty NetworkIdentifier - $datastoreIdentifier = Get-ZertoVirtualizationSite -siteIdentifier $siteIdentifier -datastores | Where-Object {$_.DatastoreName -eq $datastoreName} | Select-Object DatastoreIdentifier -ExpandProperty DatastoreIdentifier - # Build the JSON object through an Ordered Hashtable. - $vraBasic = [ordered]@{} - $vraBasic['DatastoreIdentifier'] = $datastoreIdentifier.toString() - if ($PSBoundParameters.ContainsKey('groupName')) { - $vraBasic['GroupName'] = $groupName - } - $vraBasic['HostIdentifier'] = $hostIdentifier.toString() - $vraBasic['MemoryInGB'] = $memoryInGB - $vraBasic['NetworkIdentifier'] = $networkIdentifier.toString() - $vraBasic['UsePublicKeyInsteadOfCredentials'] = $true - $vraBasicNetwork = [ordered]@{} - if ( $PSCmdlet.ParameterSetName -eq "StaticIp" ) { - $vraBasicNetwork['DefaultGateway'] = $defaultGateway.toString() - $vraBasicNetwork['SubnetMask'] = $subnetMask.toString() - $vraBasicNetwork['VraIPAddress'] = $vraIpAddress.toString() - $vraBasicNetwork['VraIPConfigurationTypeApi'] = "Static" + begin { + + } + Process { + # Build the VRA Name. + $vraName = "Z-VRA-{0}" -f $hostName + # If the VRA does not exist, proceed with the installation. If it does exist, bypass and + if ( -not (Get-ZertoVra -vraName $vraName) ) { + # Get identifiers for each item provided by name. + $siteIdentifier = (Get-ZertoLocalSite).SiteIdentifier + $hostIdentifier = Get-ZertoVirtualizationSite -siteIdentifier $siteIdentifier -hosts | Where-Object { $_.VirtualizationHostName -eq $hostName } | Select-Object hostIdentifier -ExpandProperty hostIdentifier + $networkIdentifier = Get-ZertoVirtualizationSite -siteIdentifier $siteIdentifier -networks | Where-Object { $_.VirtualizationNetworkName -eq $networkName } | Select-Object NetworkIdentifier -ExpandProperty NetworkIdentifier + $datastoreIdentifier = Get-ZertoVirtualizationSite -siteIdentifier $siteIdentifier -datastores | Where-Object { $_.DatastoreName -eq $datastoreName } | Select-Object DatastoreIdentifier -ExpandProperty DatastoreIdentifier + if ($datastoreIdentifier.count -gt 1) { + $hostDevices = Get-ZertoVirtualizationSite -siteIdentifier $siteIdentifier -devices -hostIdentifier $hostIdentifier + $datastoreIdentifier = foreach ($identifier in $datastoreIdentifier) { + if ($identifier -in $hostDevices.DatastoreIdentifier) { + $identifier + } + } + if ($datastoreIdentifier.count -gt 1) { + Write-Error "Datastore $datastoreName has more than one identifier associated with it on the specified host. Please review and try again." + Break + } + } + + # Build the JSON object through an Ordered Hashtable. + $vraBasic = [ordered]@{ } + $vraBasic['DatastoreIdentifier'] = $datastoreIdentifier.toString() + if ($PSBoundParameters.ContainsKey('groupName')) { + $vraBasic['GroupName'] = $groupName + } + $vraBasic['HostIdentifier'] = $hostIdentifier.toString() + $vraBasic['MemoryInGB'] = $memoryInGB + $vraBasic['NetworkIdentifier'] = $networkIdentifier.toString() + $vraBasic['UsePublicKeyInsteadOfCredentials'] = $true + $vraBasicNetwork = [ordered]@{ } + if ( $PSCmdlet.ParameterSetName -eq "StaticIp" -or $PSCmdlet.ParameterSetName -eq "StaticIpWithRoot") { + $vraBasicNetwork['DefaultGateway'] = $defaultGateway.toString() + $vraBasicNetwork['SubnetMask'] = $subnetMask.toString() + $vraBasicNetwork['VraIPAddress'] = $vraIpAddress.toString() + $vraBasicNetwork['VraIPConfigurationTypeApi'] = "Static" + } else { + $vraBasicNetwork['VraIPConfigurationTypeApi'] = "Dhcp" + } + $vraBasic['VraNetworkDataApi'] = $vraBasicNetwork + if ($PSCmdlet.ParameterSetName -eq "StaticIpWithRoot" -or $PSCmdlet.ParameterSetName -eq "DhcpWithRoot") { + $HostRootCredential = [pscredential]::new('root', $HostRootPassword) + $vraBasic['UsePublicKeyInsteadOfCredentials'] = $false + $vraBasic['HostRootPassword'] = $HostRootCredential.GetNetworkCredential().Password + } + + # Leverage WhatIf functionality to see what might happen, if WhatIf is not specified, attempt to install. + if ($PSCmdlet.ShouldProcess($hostName)) { + Invoke-ZertoRestRequest -uri "vras" -method POST -body $($vraBasic | ConvertTo-Json) + } } else { - $vraBasicNetwork['VraIPConfigurationTypeApi'] = "Dhcp" + Write-Error "Host $hostName already has a VRA installed. Aborting Install Call" } - $vraBasic['VraNetworkDataApi'] = $vraBasicNetwork + } + + End { - # Leverage WhatIf functionality to see what might happen, if WhatIf is not specified, attempt to install. - if ($PSCmdlet.ShouldProcess("Preforming operation 'Install-Vra' on Host $hostName with the following data \n $($vraBasic | convertto-json)")) { - Invoke-ZertoRestRequest -uri "vras" -method POST -body $($vraBasic | ConvertTo-Json) - } - } else { - Write-Error "Host $hostName already has a VRA installed. Aborting Install Call" } } diff --git a/ZertoApiWrapper/Public/Invoke-ZARestRequest.ps1 b/ZertoApiWrapper/Public/Invoke-ZARestRequest.ps1 new file mode 100644 index 0000000..52aab99 --- /dev/null +++ b/ZertoApiWrapper/Public/Invoke-ZARestRequest.ps1 @@ -0,0 +1,48 @@ +<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #> +function Invoke-ZARestRequest { + [cmdletbinding()] + param( + # Parameter help description + [Parameter( + Mandatory, + Helpmessage = "URI endpoint to be utilized. When submitting the URI, only the endpoint needs to be submitted. Please review the help documentation for examples." + )] + [ValidateNotNullOrEmpty()] + [string]$uri, + [Parameter( + Helpmessage = "API method to be used. GET, PUT, POST, or DELETE. Refer to documentation for the API endpoint to ensure the correct method is being used. If unspecified, defaults to GET" + )] + [ValidateSet("GET", "PUT", "POST", "DELETE")] + [string]$method = "GET", + [Parameter( + Helpmessage = "Body to be submitted to the REST API endpoint. This needs to be submitted in JSON format" + )] + [ValidateNotNullOrEmpty()] + [string]$body + + ) + # While the API can use XML or JSON, this module is built on JSON functionality. Currently forcing all + # content types and language to JSON. + [string]$contentType = "application/json" + + # Check to see if the required variables are present and currently valid + if ( -not ((Test-Path variable:script:zaLastActionTime) -and (Test-Path variable:script:zaHeaders)) ) { + Throw "Zerto Analytics Connection does not Exist. Please run Connect-ZertoAnalytics first to establish a connection" + } elseif ( (Test-Path variable:script:zaHeaders) -and $([datetime]$script:zaLastActionTime).addMinutes(60) -lt $(Get-Date) ) { + Throw "Authorization Token has Expired. Please re-authorize to the Zerto Analytics Portal" + } else { + # Update the last action time and submit the request based on PS Version. + Set-Variable -Name zaLastActionTime -Scope Script -Value $(Get-Date).Ticks + $submittedUri = "https://analytics.api.zerto.com/v2/{0}" -f $uri + if ($PSVersionTable.PSVersion.Major -ge 6) { + Invoke-RestMethod -Uri $submittedUri -Method $method -Body $body -Headers $Script:zaHeaders -ContentType $contentType -TimeoutSec 100 + } else { + # With PS 5, you cannot ship a $null body, check for $body variable and select correct Invoke request. + if ([String]::IsNullOrEmpty($body)) { + Invoke-RestMethod -Uri $submittedUri -Method $method -Headers $Script:zaHeaders -ContentType $contentType -TimeoutSec 100 + } else { + Invoke-RestMethod -Uri $submittedUri -Method $method -Headers $Script:zaHeaders -ContentType $contentType -TimeoutSec 100 -Body $body + } + } + } +} diff --git a/ZertoApiWrapper/Public/Invoke-ZertoEvacuateVra.ps1 b/ZertoApiWrapper/Public/Invoke-ZertoEvacuateVra.ps1 new file mode 100644 index 0000000..d01ae9e --- /dev/null +++ b/ZertoApiWrapper/Public/Invoke-ZertoEvacuateVra.ps1 @@ -0,0 +1,62 @@ +<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #> +function Invoke-ZertoEvacuateVra { + [CmdletBinding(SupportsShouldProcess, DefaultParameterSetName = "VraIdentifier")] + param ( + # HostName Option + [Parameter( + Mandatory, + HelpMessage = "Name of the Host to Evacuate", + ParameterSetName = "HostName" + )] + [ValidateNotNullOrEmpty()] + [String]$HostName, + # VRA Option + [Parameter( + Mandatory, + HelpMessage = "Name of the VRA to Evacuate", + ParameterSetName = "VraName" + )] + [ValidateNotNullOrEmpty()] + [String]$VraName, + # VRAIdentifier Option + [Parameter( + Mandatory, + HelpMessage = "Identifier of the VRA to be evacuated", + ParameterSetName = "VraIdentifier", + ValueFromPipelineByPropertyName, + ValueFromPipeline + )] + [Alias("VraId", "Identifier")] + [ValidateNotNullOrEmpty()] + [String]$VraIdentifier + ) + + begin { + + } + + process { + switch ($PSCmdlet.ParameterSetName) { + "HostName" { + $VraName = "Z-VRA-" + $HostName + Invoke-ZertoEvacuateVra -VraName $VraName + } + + "VraName" { + $VraIdentifier = (Get-ZertoVra -vraName $VraName).VraIdentifier + Invoke-ZertoEvacuateVra -VraIdentifier $VraIdentifier + } + + "VraIdentifier" { + $Uri = "vras/{0}/changerecoveryvra/execute" -f $VraIdentifier + if ($PSCmdlet.ShouldProcess($VraIdentifier, "Evacuating VRA with Identifier:")) { + Invoke-ZertoRestRequest -Uri $Uri -Method "POST" + } + } + } + } + + end { + + } +} diff --git a/ZertoApiWrapper/Public/Invoke-ZertoFailover.ps1 b/ZertoApiWrapper/Public/Invoke-ZertoFailover.ps1 index 5eb5500..013a50c 100644 --- a/ZertoApiWrapper/Public/Invoke-ZertoFailover.ps1 +++ b/ZertoApiWrapper/Public/Invoke-ZertoFailover.ps1 @@ -4,7 +4,7 @@ function Invoke-ZertoFailover { param( #TODO - Refactor? [Parameter( - Mandatory = $true, + Mandatory, HelpMessage = "Name of the VPG to Failover" )] [ValidateNotNullOrEmpty()] @@ -54,7 +54,7 @@ function Invoke-ZertoFailover { Write-Error "VPG: $vpgName Not Found. Please check the name and try again!" -ErrorAction Stop } $baseUri = "vpgs/{0}/failover" -f $vpgId - $body = @{} + $body = @{ } # Setup Required Defaults $body['commitpolicy'] = $commitPolicy $body['TimeToWaitBeforeShutdownInSec'] = $timeToWaitBeforeShutdownInSec @@ -76,7 +76,7 @@ function Invoke-ZertoFailover { $vpgVmInformation = Get-ZertoProtectedVm -vpgName $vpgName [System.Collections.ArrayList]$vmIdentifiers = @() foreach ( $name in $vmName ) { - $selectedVm = $vpgVmInformation | Where-Object {$_.VmName.toLower() -eq $name.toLower()} + $selectedVm = $vpgVmInformation | Where-Object { $_.VmName.toLower() -eq $name.toLower() } if ($null -eq $selectedVm) { Write-Error "VM: $name NOT found in VPG $vpgName. Check the name and try again." -ErrorAction Stop } elseif ($vmIdentifiers.Contains($selectedVm.vmIdentifier.toString())) { diff --git a/ZertoApiWrapper/Public/Invoke-ZertoFailoverCommit.ps1 b/ZertoApiWrapper/Public/Invoke-ZertoFailoverCommit.ps1 index cbd5250..cf91f81 100644 --- a/ZertoApiWrapper/Public/Invoke-ZertoFailoverCommit.ps1 +++ b/ZertoApiWrapper/Public/Invoke-ZertoFailoverCommit.ps1 @@ -4,7 +4,7 @@ function Invoke-ZertoFailoverCommit { param( [Parameter( HelpMessage = "Name(s) of the VPG(s) to commit.", - Mandatory = $true + Mandatory )] [ValidateNotNullOrEmpty()] [string[]]$vpgName, diff --git a/ZertoApiWrapper/Public/Invoke-ZertoFailoverRollback.ps1 b/ZertoApiWrapper/Public/Invoke-ZertoFailoverRollback.ps1 index fc6b92f..4391d65 100644 --- a/ZertoApiWrapper/Public/Invoke-ZertoFailoverRollback.ps1 +++ b/ZertoApiWrapper/Public/Invoke-ZertoFailoverRollback.ps1 @@ -4,7 +4,7 @@ function Invoke-ZertoFailoverRollback { param( [Parameter( HelpMessage = "Name(s) of VPG(s) to roll back from failing over", - Mandatory = $true + Mandatory )] [ValidateNotNullOrEmpty()] [string[]]$vpgName diff --git a/ZertoApiWrapper/Public/Invoke-ZertoForceSync.ps1 b/ZertoApiWrapper/Public/Invoke-ZertoForceSync.ps1 index 81ee866..8e5c351 100644 --- a/ZertoApiWrapper/Public/Invoke-ZertoForceSync.ps1 +++ b/ZertoApiWrapper/Public/Invoke-ZertoForceSync.ps1 @@ -4,7 +4,7 @@ function Invoke-ZertoForceSync { param( [Parameter( HelpMessage = "Name(s) of VPG(s) to force sync", - Mandatory = $true + Mandatory )] [ValidateNotNullOrEmpty()] [string[]]$vpgName diff --git a/ZertoApiWrapper/Public/Invoke-ZertoMove.ps1 b/ZertoApiWrapper/Public/Invoke-ZertoMove.ps1 index 8c7a9a3..a63bb98 100644 --- a/ZertoApiWrapper/Public/Invoke-ZertoMove.ps1 +++ b/ZertoApiWrapper/Public/Invoke-ZertoMove.ps1 @@ -1,25 +1,60 @@ <# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #> function Invoke-ZertoMove { - [CmdletBinding( DefaultParameterSetName = "main", SupportsShouldProcess = $true )] + [CmdletBinding( DefaultParameterSetName = "id", SupportsShouldProcess = $true )] param( [Parameter( + ParameterSetName = 'name', HelpMessage = "Name(s) of the VPG(s) you want to move.", - Mandatory = $true + Mandatory + )] + [Parameter( + ParameterSetName = 'commitName', + HelpMessage = "Name(s) of the VPG(s) you want to move.", + Mandatory )] [ValidateNotNullOrEmpty()] [string[]]$vpgName, [Parameter( + ParameterSetName = 'id', + HelpMessage = "ID(s) of the VPG(s) you want to move.", + Mandatory, + ValueFromPipelineByPropertyName + )] + [Parameter( + ParameterSetName = 'commitId', + HelpMessage = "ID(s) of the VPG(s) you want to move.", + Mandatory, + ValueFromPipelineByPropertyName + )] + [ValidateNotNullOrEmpty()] + [guid[]]$vpgIdentifier, + [Parameter( + ParameterSetName = 'commitName', HelpMessage = "'Rollback': After the seconds specified in the commitValue setting have elapsed, the failover is rolled back. 'Commit': After the seconds specified in the commitValue setting have elapsed, the failover continues, committing the virtual machines in the recovery site. 'None': The virtual machines in the VPG being failed over remain in the Before Commit state until either they are committed with Commit a failover, or rolled back with Roll back a failover. - Default is the Site Settings setting." + Default is the Site Settings setting.", + Mandatory + )] + [Parameter( + ParameterSetName = 'commitId', + HelpMessage = "'Rollback': After the seconds specified in the commitValue setting have elapsed, the failover is rolled back. + 'Commit': After the seconds specified in the commitValue setting have elapsed, the failover continues, committing the virtual machines in the recovery site. + 'None': The virtual machines in the VPG being failed over remain in the Before Commit state until either they are committed with Commit a failover, or rolled back with Roll back a failover. + Default is the Site Settings setting.", + Mandatory )] [ValidateSet("Rollback", "Commit", "None")] [string]$commitPolicy, [Parameter( + ParameterSetName = 'commitName', HelpMessage = "The amount of time, in seconds, the Move is in a 'Before Commit' state, before performing the commitPolicy setting. If omitted, the site settings default will be applied." )] - # Min 5 Minutes, Max 24 Hours, Default 1 Hour. + [Parameter( + ParameterSetName = 'commitId', + HelpMessage = "The amount of time, in seconds, the Move is in a 'Before Commit' state, before performing the commitPolicy setting. If omitted, the site settings default will be applied." + )] + # Min 5 Minutes, Max 24 Hours, Default Site Settigns. [ValidateRange(300, 86400)] [Int]$commitPolicyTimeout, [Parameter( @@ -27,15 +62,11 @@ function Invoke-ZertoMove { )] [switch]$forceShutdown, [Parameter( - ParameterSetName = "disableReverseProtection", - HelpMessage = "Do not enable reverse protection. The VPG definition is kept with the status Needs Configuration and the reverse settings in the VPG definition are not set.", - Mandatory = $true + HelpMessage = "Do not enable reverse protection. The VPG definition is kept with the status Needs Configuration and the reverse settings in the VPG definition are not set." )] [switch]$disableReverseProtection, [Parameter( - ParameterSetName = "keepSourceVms", - HelpMessage = "Prevent the protected virtual machines from being deleted in the protected site. Using this setting disables reverse protection.", - Mandatory = $true + HelpMessage = "Prevent the protected virtual machines from being deleted in the protected site. Using this setting disables reverse protection." )] [switch]$keepSourceVms, [Parameter( @@ -46,53 +77,51 @@ function Invoke-ZertoMove { begin { $baseUri = "vpgs" - $body = [ordered]@{} - #TODO - use a foreach loop to populate the body without all the if statments - if ($PSBoundParameters.ContainsKey('commitPolicy')) { - $body['commitPolicy'] = $commitPolicy - } - if ($PSBoundParameters.ContainsKey('commitPolicyTimeout')) { - $body['commitPolicyTimeout'] = $commitPolicyTimeout - } - if ($PSBoundParameters.ContainsKey('forceShutdown')) { - $body['forceShutdown'] = $true - } else { - $body['forceShutdown'] = $false + $body = @{ + forceShutdown = $forceShutdown.IsPresent + ContinueOnPreScriptFailure = $ContinueOnPreScriptFailure.IsPresent + keepSourceVms = $keepSourceVms.IsPresent + reverseProtection = -not $disableReverseProtection.IsPresent } - if ($PSBoundParameters.ContainsKey('ContinueOnPreScriptFailure')) { - $body['ContinueOnPreScriptFailure'] = $true - } else { - $body['ContinueOnPreScriptFailure'] = $false - } - switch ($PSCmdlet.ParameterSetName) { - "disableReverseProtection" { - $body['reverseProtection'] = $false - $body['keepSourceVms'] = $false - } - "keepSourceVms" { - $body['reverseProtection'] = $false - $body['keepSourceVms'] = $true - } + if ( $keepSourceVms.IsPresent -and -not $disableReverseProtection.IsPresent ) { + Write-Verbose 'Disabling reverse protection as keepSourceVms requires it' + $body['reverseProtection'] = $false + } - "main" { - $body['reverseProtection'] = $true - $body['keepSourceVms'] = $false + if ($PSBoundParameters.ContainsKey('commitPolicy')) { + $body['commitPolicy'] = $commitPolicy + if ($PSBoundParameters.ContainsKey('commitPolicyTimeout')) { + $body['commitPolicyTimeout'] = $commitPolicyTimeout } } } process { - foreach ($name in $vpgName) { - $vpgId = $(Get-ZertoVpg -name $name).vpgIdentifier - if ( -not $vpgId ) { - Write-Error "VPG: $name not found. Please check the name and try again. Skipping" - } else { - $uri = "{0}/{1}/move" -f $baseUri, $vpgId - if ($PSCmdlet.ShouldProcess("Moving VPG: $name wiht settings: $($body | convertto-json)")) { - Invoke-ZertoRestRequest -uri $uri -method "POST" -body $($body | ConvertTo-Json) + + switch ($PSCmdlet.ParameterSetName) { + { $_ -in 'name', 'commitName' } { + $vpgIds = foreach ($name in $vpgName) { + $vpgId = $(Get-ZertoVpg -name $name).vpgIdentifier + if ( -not $vpgId ) { + Write-Error "VPG: '$name' not found. Please check the name and try again. Skipping" + } else { + Write-Verbose "VPG: $name, ID: $vpgId" + $vpgId + } } } + + { $_ -in 'id', 'commitId' } { + $vpgIds = $vpgIdentifier + } + } + + foreach ($thisId in $vpgIds) { + $uri = "{0}/{1}/move" -f $baseUri, $thisId + if ($PSCmdlet.ShouldProcess("Moving VPG: $thisId with settings: $($body | ConvertTo-Json)")) { + Invoke-ZertoRestRequest -uri $uri -method "POST" -body $($body | ConvertTo-Json) + } } } diff --git a/ZertoApiWrapper/Public/Invoke-ZertoMoveCommit.ps1 b/ZertoApiWrapper/Public/Invoke-ZertoMoveCommit.ps1 index f524af1..81f5f79 100644 --- a/ZertoApiWrapper/Public/Invoke-ZertoMoveCommit.ps1 +++ b/ZertoApiWrapper/Public/Invoke-ZertoMoveCommit.ps1 @@ -1,30 +1,41 @@ <# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #> function Invoke-ZertoMoveCommit { - [cmdletbinding(SupportsShouldProcess = $true)] + [cmdletbinding(SupportsShouldProcess = $true, DefaultParameterSetName = "Main")] param( [Parameter( HelpMessage = "Name(s) of the VPG(s) to commit.", - Mandatory = $true + Mandatory )] [ValidateNotNullOrEmpty()] [string[]]$vpgName, [Parameter( - HelpMessage = "Set this to True to reverse protect the VPG(s) to the source site. If not set, will use selection made during move initiation. True or False" + HelpMessage = "Use this switch to reverse protect the VPG(s) to the source site. If neither 'ReverseProtction' nor 'KeepSourceVms' switch is specified, the commit process will use selection made during move initiation.", + ParameterSetName = 'ReverseProtect', + Mandatory + )] [switch]$reverseProtection, [Parameter( - HelpMessage = "Use this switch to keep the source VMs. If not set, they will be destroyed." + HelpMessage = "Use this switch to keep the source VMs at the source site. If neither 'ReverseProtction' nor 'KeepSourceVms' switch is specified, the commit process will use selection made during move initiation.", + ParameterSetName = 'KeepSource', + Mandatory )] [switch]$keepSourceVms ) begin { $baseUri = "vpgs" - $body = @{} - if ($reverseProtection) { - $body["ReverseProtection"] = $true - } elseif ($keepSourceVms) { - $body["KeepSourceVms"] = $true + $body = @{ } + Switch ($PSCmdlet.ParameterSetName){ + 'KeepSource' { + $body["KeepSourceVms"] = $true + $body["ReverseProtection"] = $false + } + + 'ReverseProtect' { + $body["ReverseProtection"] = $true + $body["KeepSourceVms"] = $false + } } } diff --git a/ZertoApiWrapper/Public/Invoke-ZertoMoveRollback.ps1 b/ZertoApiWrapper/Public/Invoke-ZertoMoveRollback.ps1 index b1d7e24..36728dd 100644 --- a/ZertoApiWrapper/Public/Invoke-ZertoMoveRollback.ps1 +++ b/ZertoApiWrapper/Public/Invoke-ZertoMoveRollback.ps1 @@ -4,7 +4,7 @@ function Invoke-ZertoMoveRollback { param( [Parameter( HelpMessage = "Name(s) of VPG(s) to roll back from failing over", - Mandatory = $true + Mandatory )] [ValidateNotNullOrEmpty()] [string[]]$vpgName diff --git a/ZertoApiWrapper/Public/Invoke-ZertoRestRequest.ps1 b/ZertoApiWrapper/Public/Invoke-ZertoRestRequest.ps1 new file mode 100644 index 0000000..93d77e4 --- /dev/null +++ b/ZertoApiWrapper/Public/Invoke-ZertoRestRequest.ps1 @@ -0,0 +1,110 @@ +<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #> +function Invoke-ZertoRestRequest { + [cmdletbinding()] + param( + # Parameter help description + [Parameter( + Helpmessage = "API method to be used. GET, PUT, POST, or DELETE. Refer to documentation for the API endpoint to ensure the correct method is being used. If unspecified, defaults to GET" + )] + [ValidateSet("GET", "PUT", "POST", "DELETE")] + [string]$method = "GET", + [Parameter( + Mandatory, + Helpmessage = "URI endpoint to be utilized. When submitting the URI, only the endpoint needs to be submitted. Please review the help documentation for examples." + )] + [ValidateNotNullOrEmpty()] + [string]$uri, + [Parameter( + Helpmessage = "Body to be submitted to the REST API endpoint. This needs to be submitted in JSON format" + )] + [ValidateNotNullOrEmpty()] + [string]$body, + [Parameter( + Helpmessage = "PSCredential object. This is ONLY used when authenticating with the ZVM. No other endpoints require this and generally is not used." + )] + [PSCredential]$credential, + [Parameter( + Helpmessage = "Use this switch if you would like the request headers returned along with the body. Useful for troubleshooting to get HTTP error codes." + )] + [switch]$returnHeaders + ) + # API version. Currently this is locked at v1 in all versions of Zerto. Should this change, will look + # at making this as parameter to be selected during function call. + $apiVersion = "v1" + # While the API can use XML or JSON, this module is built on JSON functionality. Currently forcing all + # content types and language to JSON. + $contentType = "application/json" + $callerErrorActionPreference = $ErrorActionPreference + # If the ZVM server and Port not defined, Stop Call + if ( -not ((Test-Path variable:script:zvmServer) -and (Test-Path variable:script:zvmPort)) ) { + Throw "Zerto Connection does not Exist. Please run Connect-ZertoServer first to establish a connection" + } + + # If the Headers exist and the Last action was more than 30 minutes ago, Session is Expired + if ( (Test-Path variable:script:zvmHeaders) -and $([datetime]$script:zvmLastAction).addMinutes(30) -lt $(Get-Date) -and $Script:Reconnect -eq $False ) { + Throw "Authorization Token has Expired. Please re-authorize to the Zerto Virtual Manager" + } elseif (( (Test-Path variable:script:zvmHeaders) -and $([datetime]$script:zvmLastAction).addMinutes(30) -lt $(Get-Date) -and $Script:Reconnect -eq $True )) { + Write-Verbose "Authorization had expired. Attempting Reauthorization." + Connect-ZertoServer -zertoServer $Script:zvmServer -zertoPort $script:zvmPort -credential $Script:CachedCredential + }# else { + # Build the URI to be submitted + $submittedURI = "https://{0}:{1}/{2}/{3}" -f $script:zvmServer, $script:zvmPort, $apiVersion, $uri + try { + # Set the zvmLastAction time and try to submit the REST Request + $script:zvmLastAction = (Get-Date).Ticks + # If running PwSh - Use this Invoke-RestMethod with passed Variables + if ($PSVersionTable.PSVersion.Major -ge 6) { + $apiRequestResults = Invoke-RestMethod -Uri $submittedURI -Headers $script:zvmHeaders -Method $method -Body $body -ContentType $contentType -Credential $credential -SkipCertificateCheck -ResponseHeadersVariable responseHeaders -TimeoutSec 100 + } else { + # If running PowerShell 5.1 --> Do the Following + # Check to see if All Certs are Trusted. If not, Create the Policy to Trust All Certificates + if ([System.Net.ServicePointManager]::CertificatePolicy.GetType().Name -ne "TrustAllCertsPolicy") { + Try { + $type = @' +using System.Net; +using System.Security.Cryptography.X509Certificates; +public class TrustAllCertsPolicy : ICertificatePolicy { + public bool CheckValidationResult( ServicePoint srvPoint, X509Certificate certificate, WebRequest request, int certificateProblem) { + return true; + } +} +'@ + Add-Type -TypeDefinition $type -ErrorAction SilentlyContinue + } Catch { + if ($error[0].Exception -ne "Cannot add type. The type name 'TrustAllCertsPolicy already exists.") { + Write-Debug $error[0] + } + } + [System.Net.ServicePointManager]::CertificatePolicy = New-Object TrustAllCertsPolicy + + } + # If we are authenticating to the ZVM, Use this block to use Invoke-WebRequest and format the Headers as expected. + if ($uri -eq "session/add" -and $method -eq "POST") { + $apiRequestResults = Invoke-WebRequest -Uri $submittedURI -Headers $script:zvmHeaders -Method $method -Body $body -ContentType $contentType -Credential $credential -TimeoutSec 100 + $responseHeaders = @{ } + $responseHeaders['x-zerto-session'] = @($apiRequestResults.Headers['x-zerto-session']) + } elseif ($method -ne "GET") { + # If the Method is something other than 'GET' use this call with a body parameter + $apiRequestResults = Invoke-RestMethod -Uri $submittedURI -Headers $script:zvmHeaders -Method $method -Body $body -ContentType $contentType -Credential $credential -TimeoutSec 100 + } else { + # If the Method we are calling is 'GET' use this call without a body parameter + $apiRequestResults = Invoke-RestMethod -Uri $submittedURI -Headers $script:zvmHeaders -Method $method -ContentType $contentType -Credential $credential -TimeoutSec 100 + } + } + } catch { + # If an error is encountered, Catch + Write-Error -ErrorRecord $_ -ErrorAction $callerErrorActionPreference + } + + # If the calling function does not need the headers (Default Action) return the results of the API Call + if (-not $returnHeaders) { + return $apiRequestResults + } else { + #If Headers are required, build a PS Custom Object with the Results and the Headers + $apiRequestAndHeaderResults = New-Object -TypeName psobject + $apiRequestAndHeaderResults | Add-Member -MemberType NoteProperty -Name "apiRequestResults" -Value $apiRequestResults + $apiRequestAndHeaderResults | Add-Member -MemberType NoteProperty -Name "Headers" -Value $responseHeaders + return $apiRequestAndHeaderResults + #} + } +} diff --git a/ZertoApiWrapper/Public/New-ZertoPairingToken.ps1 b/ZertoApiWrapper/Public/New-ZertoPairingToken.ps1 new file mode 100644 index 0000000..2eca94d --- /dev/null +++ b/ZertoApiWrapper/Public/New-ZertoPairingToken.ps1 @@ -0,0 +1,23 @@ +<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #> +function New-ZertoPairingToken { + [CmdletBinding(SupportsShouldProcess = $true)] + param ( + + ) + + begin { + + } + + process { + $uri = "peersites/generatetoken" + $body = @{ } + if ($PSCmdlet.ShouldProcess("Obtaining Pairing token from $script:zvmServer")) { + Invoke-ZertoRestRequest -uri $uri -method "POST" -body $($body | ConvertTo-Json) + } + } + + end { + + } +} diff --git a/ZertoApiWrapper/Public/New-ZertoVpg.ps1 b/ZertoApiWrapper/Public/New-ZertoVpg.ps1 index a4885f5..d46b818 100644 --- a/ZertoApiWrapper/Public/New-ZertoVpg.ps1 +++ b/ZertoApiWrapper/Public/New-ZertoVpg.ps1 @@ -1,10 +1,10 @@ <# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #> function New-ZertoVpg { - [cmdletbinding(SupportsShouldProcess = $true)] + [cmdletbinding(SupportsShouldProcess = $true, DefaultParameterSetName = "recoveryHostDatastore")] param( [Parameter( HelpMessage = "Name of the VPG", - Mandatory = $true + Mandatory )] [ValidateNotNullOrEmpty()] [string]$vpgName, @@ -20,89 +20,89 @@ function New-ZertoVpg { [int]$journalHistoryInHours = 24, [Parameter( HelpMessage = "Name(s) of the VM(s) to be protected.", - Mandatory = $true + Mandatory )] [ValidateNotNullOrEmpty()] [string[]]$protectedVm, [Parameter( HelpMessage = "Name of the site where the VM(s) will be recovered", - Mandatory = $true + Mandatory )] [ValidateNotNullOrEmpty()] [string]$recoverySite, [Parameter( HelpMessage = "Name of the cluster where the VM(s) will be recovered.", ParameterSetName = "recoveryClusterDatastore", - Mandatory = $true + Mandatory )] [Parameter( HelpMessage = "Name of the cluster where the VM(s) will be recovered.", ParameterSetName = "recoveryClusterDatastoreCluster", - Mandatory = $true + Mandatory )] [ValidateNotNullOrEmpty()] [string]$recoveryCluster, [Parameter( HelpMessage = "Name of the host where the VM(s) will be recovered.", ParameterSetName = "recoveryHostDatastore", - Mandatory = $true + Mandatory )] [Parameter( HelpMessage = "Name of the host where the VM(s) will be recovered.", ParameterSetName = "recoveryHostDatastoreCluster", - Mandatory = $true + Mandatory )] [ValidateNotNullOrEmpty()] [string]$recoveryHost, [Parameter( HelpMessage = "Name of the resource pool where the VM(s) will be recovered.", ParameterSetName = "recoveryResourcePoolDatastore", - Mandatory = $true + Mandatory )] [Parameter( HelpMessage = "Name of the resource pool where the VM(s) will be recovered.", ParameterSetName = "recoveryResourcePoolDatastoreCluster", - Mandatory = $true + Mandatory )] [ValidateNotNullOrEmpty()] [string]$recoveryResourcePool, [Parameter( HelpMessage = "Name of the datastore where the VM(s), Volume(s), and Journal(s) will reside.", ParameterSetName = "recoveryClusterDatastore", - Mandatory = $true + Mandatory )] [Parameter( HelpMessage = "Name of the datastore where the VM(s), Volume(s), and Journal(s) will reside.", ParameterSetName = "recoveryHostDatastore", - Mandatory = $true + Mandatory )] [Parameter( HelpMessage = "Name of the datastore where the VM(s), Volume(s), and Journal(s) will reside.", ParameterSetName = "recoveryResourcePoolDatastore", - Mandatory = $true + Mandatory )] [ValidateNotNullOrEmpty()] [string]$datastore, [Parameter( HelpMessage = "Name of the datastore cluster where the VM(s), Volume(s), and Journal(s) will reside.", ParameterSetName = "recoveryClusterDatastoreCluster", - Mandatory = $true + Mandatory )] [Parameter( HelpMessage = "Name of the datastore cluster where the VM(s), Volume(s), and Journal(s) will reside.", ParameterSetName = "recoveryHostDatastoreCluster", - Mandatory = $true + Mandatory )] [Parameter( HelpMessage = "Name of the datastore cluster where the VM(s), Volume(s), and Journal(s) will reside.", ParameterSetName = "recoveryResourcePoolDatastoreCluster", - Mandatory = $true + Mandatory )] [ValidateNotNullOrEmpty()] [string]$datastoreCluster, [Parameter( HelpMessage = "Name of folder at recovery location where the recovered virtual machine(s) will be created.", - Mandatory = $true + Mandatory )] [ValidateNotNullOrEmpty()] [string]$recoveryFolder, @@ -132,13 +132,13 @@ function New-ZertoVpg { [String]$zorg, [Parameter( HelpMessage = "Name of the network to use during a Failover Live \ Move VPG operation.", - Mandatory = $true + Mandatory )] [ValidateNotNullOrEmpty()] [String]$recoveryNetwork, [Parameter( HelpMessage = "Name of the network to use during a Failover Test operation", - Mandatory = $true + Mandatory )] [ValidateNotNullOrEmpty()] [string]$testNetwork, @@ -164,64 +164,63 @@ function New-ZertoVpg { begin { # Create an identifiers table, and start converting names to identifiers. - $identifiersTable = @{} - $identifiersTable['recoverySiteIdentifier'] = $(Get-ZertoPeerSite -peerName $recoverySite).siteIdentifier + $identifiersTable = @{ } + $identifiersTable['recoverySiteIdentifier'] = Get-ZertoVirtualizationSite | Where-Object { $_.VirtualizationSiteName -like $recoverySite } | Select-Object -ExpandProperty SiteIdentifier $peerSiteNetworks = $(Get-ZertoVirtualizationSite -siteIdentifier $identifiersTable['recoverySiteIdentifier'] -networks) - $identifiersTable['failoverNetworkIdentifier'] = $peerSiteNetworks | Where-Object {$_.VirtualizationNetworkName -like $recoveryNetwork} | Select-Object -ExpandProperty NetworkIdentifier - $identifiersTable['testNetworkIdentifier'] = $peerSiteNetworks | Where-Object {$_.VirtualizationNetworkName -like $testNetwork} | Select-Object -ExpandProperty NetworkIdentifier - $identifiersTable['folderIdentifier'] = $(Get-ZertoVirtualizationSite -siteIdentifier $identifiersTable['recoverySiteIdentifier'] -folders | Where-Object {$_.FolderName -like $recoveryFolder}).folderIdentifier + $identifiersTable['failoverNetworkIdentifier'] = $peerSiteNetworks | Where-Object { $_.VirtualizationNetworkName -like $recoveryNetwork } | Select-Object -ExpandProperty NetworkIdentifier + $identifiersTable['testNetworkIdentifier'] = $peerSiteNetworks | Where-Object { $_.VirtualizationNetworkName -like $testNetwork } | Select-Object -ExpandProperty NetworkIdentifier + $identifiersTable['folderIdentifier'] = $(Get-ZertoVirtualizationSite -siteIdentifier $identifiersTable['recoverySiteIdentifier'] -folders | Where-Object { $_.FolderName -like $recoveryFolder }).folderIdentifier if ($PSBoundParameters.ContainsKey("zorg")) { - $identifiersTable['zorgIdentifier'] = $(Get-ZertoZorg | Where-Object {$_.ZorgName -like $zorg}).ZorgIdentifier + $identifiersTable['zorgIdentifier'] = $(Get-ZertoZorg | Where-Object { $_.ZorgName -like $zorg }).ZorgIdentifier } if ($PSBoundParameters.ContainsKey("serviceProfile")) { - $identifiersTable['serviceProfileIdentifier'] = $(Get-ZertoServiceProfile -siteIdentifier $identifiersTable['recoverySiteIdentifier'] | Where-Object {$_.ServiceProfileName -like $serviceProfile}).serviceProfileIdentifier + $identifiersTable['serviceProfileIdentifier'] = $(Get-ZertoServiceProfile -siteIdentifier $identifiersTable['recoverySiteIdentifier'] | Where-Object { $_.ServiceProfileName -like $serviceProfile }).serviceProfileIdentifier } if ($PSBoundParameters.ContainsKey('journalDatastore')) { - $identifiersTable['journalDatastore'] = $(Get-ZertoVirtualizationSite -siteIdentifier $identifiersTable['recoverySiteIdentifier'] -datastores | Where-Object {$_.DatastoreName -like $journalDatastore}).DatastoreIdentifier + $identifiersTable['journalDatastore'] = $(Get-ZertoVirtualizationSite -siteIdentifier $identifiersTable['recoverySiteIdentifier'] -datastores | Where-Object { $_.DatastoreName -like $journalDatastore }).DatastoreIdentifier } # Get identifiers based on parameter set name switch ($PSCmdlet.ParameterSetName) { "recoveryClusterDatastoreCluster" { - $identifiersTable['clusterIdentifier'] = $(Get-ZertoVirtualizationSite -siteIdentifier $identifiersTable['recoverySiteIdentifier'] -hostclusters | Where-Object {$_.VirtualizationClusterName -like $recoveryCluster}).ClusterIdentifier - $identifiersTable['datastoreClusterIdentifier'] = $(Get-ZertoVirtualizationSite -siteIdentifier $identifiersTable['recoverySiteIdentifier'] -datastoreclusters | Where-Object {$_.DatastoreClusterName -like $datastoreCluster}).DatastoreClusterIdentifier + $identifiersTable['clusterIdentifier'] = $(Get-ZertoVirtualizationSite -siteIdentifier $identifiersTable['recoverySiteIdentifier'] -hostClusters | Where-Object { $_.VirtualizationClusterName -like $recoveryCluster }).ClusterIdentifier + $identifiersTable['datastoreClusterIdentifier'] = $(Get-ZertoVirtualizationSite -siteIdentifier $identifiersTable['recoverySiteIdentifier'] -datastoreClusters | Where-Object { $_.DatastoreClusterName -like $datastoreCluster }).DatastoreClusterIdentifier } "recoveryClusterDatastore" { - $identifiersTable['clusterIdentifier'] = $(Get-ZertoVirtualizationSite -siteIdentifier $identifiersTable['recoverySiteIdentifier'] -hostclusters | Where-Object {$_.VirtualizationClusterName -like $recoveryCluster}).ClusterIdentifier - $identifiersTable['datastoreIdentifier'] = $(Get-ZertoVirtualizationSite -siteIdentifier $identifiersTable['recoverySiteIdentifier'] -datastores | Where-Object {$_.DatastoreName -like $datastore}).DatastoreIdentifier + $identifiersTable['clusterIdentifier'] = $(Get-ZertoVirtualizationSite -siteIdentifier $identifiersTable['recoverySiteIdentifier'] -hostClusters | Where-Object { $_.VirtualizationClusterName -like $recoveryCluster }).ClusterIdentifier + $identifiersTable['datastoreIdentifier'] = $(Get-ZertoVirtualizationSite -siteIdentifier $identifiersTable['recoverySiteIdentifier'] -datastores | Where-Object { $_.DatastoreName -like $datastore }).DatastoreIdentifier } "recoveryHostDatastoreCluster" { - $identifiersTable['recoveryHostIdentifier'] = $(Get-ZertoVirtualizationSite -siteIdentifier $identifiersTable['recoverySiteIdentifier'] -hosts | Where-Object {$_.VirtualizationHostName -like $recoveryHost}).HostIdentifier - $identifiersTable['datastoreClusterIdentifier'] = $(Get-ZertoVirtualizationSite -siteIdentifier $identifiersTable['recoverySiteIdentifier'] -datastoreclusters | Where-Object {$_.DatastoreClusterName -like $datastoreCluster}).DatastoreClusterIdentifier + $identifiersTable['recoveryHostIdentifier'] = $(Get-ZertoVirtualizationSite -siteIdentifier $identifiersTable['recoverySiteIdentifier'] -hosts | Where-Object { $_.VirtualizationHostName -like $recoveryHost }).HostIdentifier + $identifiersTable['datastoreClusterIdentifier'] = $(Get-ZertoVirtualizationSite -siteIdentifier $identifiersTable['recoverySiteIdentifier'] -datastoreClusters | Where-Object { $_.DatastoreClusterName -like $datastoreCluster }).DatastoreClusterIdentifier } "recoveryHostDatastore" { - $identifiersTable['recoveryHostIdentifier'] = $(Get-ZertoVirtualizationSite -siteIdentifier $identifiersTable['recoverySiteIdentifier'] -hosts | Where-Object {$_.VirtualizationHostName -like $recoveryHost}).HostIdentifier - $identifiersTable['datastoreIdentifier'] = $(Get-ZertoVirtualizationSite -siteIdentifier $identifiersTable['recoverySiteIdentifier'] -datastores | Where-Object {$_.DatastoreName -like $datastore}).DatastoreIdentifier + $identifiersTable['recoveryHostIdentifier'] = $(Get-ZertoVirtualizationSite -siteIdentifier $identifiersTable['recoverySiteIdentifier'] -hosts | Where-Object { $_.VirtualizationHostName -like $recoveryHost }).HostIdentifier + $identifiersTable['datastoreIdentifier'] = $(Get-ZertoVirtualizationSite -siteIdentifier $identifiersTable['recoverySiteIdentifier'] -datastores | Where-Object { $_.DatastoreName -like $datastore }).DatastoreIdentifier } "recoveryResourcePoolDatastoreCluster" { - $identifiersTable['recoveryResourcePoolIdentifier'] = $(Get-ZertoVirtualizationSite -siteIdentifier $identifiersTable['recoverySiteIdentifier'] -resourcepools | Where-Object {$_.ResourcePoolName -like $recoveryResourcePool}).ResourcePoolIdentifier - $identifiersTable['datastoreClusterIdentifier'] = $(Get-ZertoVirtualizationSite -siteIdentifier $identifiersTable['recoverySiteIdentifier'] -datastoreclusters | Where-Object {$_.DatastoreClusterName -like $datastoreCluster}).DatastoreClusterIdentifier + $identifiersTable['recoveryResourcePoolIdentifier'] = $(Get-ZertoVirtualizationSite -siteIdentifier $identifiersTable['recoverySiteIdentifier'] -resourcePools | Where-Object { $_.ResourcePoolName -like $recoveryResourcePool }).ResourcePoolIdentifier + $identifiersTable['datastoreClusterIdentifier'] = $(Get-ZertoVirtualizationSite -siteIdentifier $identifiersTable['recoverySiteIdentifier'] -datastoreClusters | Where-Object { $_.DatastoreClusterName -like $datastoreCluster }).DatastoreClusterIdentifier } "recoveryResourcePoolDatastore" { - $identifiersTable['recoveryResourcePoolIdentifier'] = $(Get-ZertoVirtualizationSite -siteIdentifier $identifiersTable['recoverySiteIdentifier'] -resourcepools | Where-Object {$_.ResourcePoolName -like $recoveryResourcePool}).ResourcePoolIdentifier - $identifiersTable['datastoreIdentifier'] = $(Get-ZertoVirtualizationSite -siteIdentifier $identifiersTable['recoverySiteIdentifier'] -datastores | Where-Object {$_.DatastoreName -like $datastore}).DatastoreIdentifier + $identifiersTable['recoveryResourcePoolIdentifier'] = $(Get-ZertoVirtualizationSite -siteIdentifier $identifiersTable['recoverySiteIdentifier'] -resourcePools | Where-Object { $_.ResourcePoolName -like $recoveryResourcePool }).ResourcePoolIdentifier + $identifiersTable['datastoreIdentifier'] = $(Get-ZertoVirtualizationSite -siteIdentifier $identifiersTable['recoverySiteIdentifier'] -datastores | Where-Object { $_.DatastoreName -like $datastore }).DatastoreIdentifier } } $unprotectedVms = Get-ZertoUnprotectedVm $protectedVms = Get-ZertoProtectedVm # Create array of VM identifiers - $vmIdentifiers = @() $vmIdentifiers = foreach ($vm in $protectedVm) { # If the VM is unprotected, get the identifier - $vmIdentifier = $unprotectedVms | Where-Object {$_.vmName -like $vm} | Select-Object -ExpandProperty vmIdentifier + $vmIdentifier = $unprotectedVms | Where-Object { $_.vmName -like $vm } | Select-Object -ExpandProperty vmIdentifier # If the VM is not unprotected, check the protected VMs if ( -not $vmIdentifier) { # Get all identifiers to test if the VM is eligible to be a member of an additional VPG - $results = $protectedVms | Where-Object {$_.VmName -like $vm} | Select-Object -ExpandProperty vmIdentifier + $results = $protectedVms | Where-Object { $_.VmName -like $vm } | Select-Object -ExpandProperty vmIdentifier # If VM is currently a member of 3 VPGs, skip it. If it cannot be found, skip it. Otherwise, set the identifier if ($results.count -eq 3) { Write-Warning "$vm is already a part of 3 VPGs and cannot be part of an additional VPG. Skipping $vm" @@ -296,11 +295,11 @@ function New-ZertoVpg { "recoveryHostDatastoreCluster" { $baseSettings.Recovery.DefaultDatastoreClusterIdentifier = $identifiersTable['datastoreClusterIdentifier'] - $baseSettings.Recovery.DefaultHostIdentifier = $identifiersTable['hostIdentifier'] + $baseSettings.Recovery.DefaultHostIdentifier = $identifiersTable['recoveryHostIdentifier'] } "recoveryHostDatastore" { - $baseSettings.Recovery.DefaultHostIdentifier = $identifiersTable['hostIdentifier'] + $baseSettings.Recovery.DefaultHostIdentifier = $identifiersTable['recoveryHostIdentifier'] $baseSettings.Recovery.DefaultDatastoreIdentifier = $identifiersTable['datastoreIdentifier'] } @@ -314,13 +313,7 @@ function New-ZertoVpg { $baseSettings.Recovery.DefaultDatastoreIdentifier = $identifiersTable['datastoreIdentifier'] } } - # If only 1 VM is selected, force VMs settings to be an array. - If ($vmIdentifiers.count -eq 1) { - $basesettings.Vms = @() - $baseSettings.Vms += $vmIdentifiers - } else { - $baseSettings.Vms = $vmIdentifiers - } + $basesettings.Vms += $vmIdentifiers if ($identifiersTable.ContainsKey('journalDatastore')) { $baseSettings.Journal.DatastoreIdentifier = $identifiersTable['journalDatastore'] } diff --git a/ZertoApiWrapper/Public/New-ZertoVpgSettingsIdentifier.ps1 b/ZertoApiWrapper/Public/New-ZertoVpgSettingsIdentifier.ps1 index 06150d2..53efea7 100644 --- a/ZertoApiWrapper/Public/New-ZertoVpgSettingsIdentifier.ps1 +++ b/ZertoApiWrapper/Public/New-ZertoVpgSettingsIdentifier.ps1 @@ -5,7 +5,7 @@ function New-ZertoVpgSettingsIdentifier { [Parameter( HelpMessage = "Identifier of the VPG to create a VPG settings identifier. If a vpgIdentifier is not provided, a new VPG settings object is created without any configured settings. This would be used for creating a new VPG from scratch.", ParameterSetName = "existingVpg", - Mandatory = $true, + Mandatory, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true )] @@ -15,7 +15,7 @@ function New-ZertoVpgSettingsIdentifier { [Parameter( HelpMessage = "Use this switch when creating a vpgSettingsIdentifier for a new VPG", ParameterSetName = "newVpg", - Mandatory = $true + Mandatory )] [switch]$newVpg ) diff --git a/ZertoApiWrapper/Public/Remove-ZertoPeerSite.ps1 b/ZertoApiWrapper/Public/Remove-ZertoPeerSite.ps1 index 0d818e9..64e4289 100644 --- a/ZertoApiWrapper/Public/Remove-ZertoPeerSite.ps1 +++ b/ZertoApiWrapper/Public/Remove-ZertoPeerSite.ps1 @@ -10,7 +10,7 @@ function Remove-ZertoPeerSite { ParameterSetName = "siteIdentifier", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, - Mandatory = $true + Mandatory )] [ValidateNotNullOrEmpty()] [Alias("siteId")] @@ -20,7 +20,7 @@ function Remove-ZertoPeerSite { ParameterSetName = "peerSiteName", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, - Mandatory = $true + Mandatory )] [ValidateNotNullOrEmpty()] [string[]]$peerSiteName, @@ -29,9 +29,9 @@ function Remove-ZertoPeerSite { ParameterSetName = "hostName", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, - Mandatory = $true + Mandatory )] - [ValidateScript( {$_ -match [IPAddress]$_ })] + [ValidateScript( { $_ -match [IPAddress]$_ })] [string[]]$hostName, [Parameter( HelpMessage = "Specify this switch to Keep the target replica disks for any VPGs replicating between the sites as the VPGs will be deleted by unpairing the sites. If this switch is not used, the target replica disks will be deleted" @@ -41,7 +41,7 @@ function Remove-ZertoPeerSite { begin { $baseUri = "peersites" - $body = @{} + $body = @{ } if ( $keepTargetDisks ) { $body['IsKeepTargetDisks'] = $true } else { @@ -78,4 +78,4 @@ function Remove-ZertoPeerSite { end { # Nothing to do } -} \ No newline at end of file +} diff --git a/ZertoApiWrapper/Public/Remove-ZertoVpg.ps1 b/ZertoApiWrapper/Public/Remove-ZertoVpg.ps1 index 5e453fb..e389705 100644 --- a/ZertoApiWrapper/Public/Remove-ZertoVpg.ps1 +++ b/ZertoApiWrapper/Public/Remove-ZertoVpg.ps1 @@ -3,7 +3,7 @@ function Remove-ZertoVpg { [cmdletbinding( SupportsShouldProcess = $true, DefaultParameterSetName = "vpgIdentifier" )] param( [Parameter( - Mandatory = $true, + Mandatory, ParameterSetName = "vpgName", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, @@ -12,7 +12,7 @@ function Remove-ZertoVpg { [ValidateNotNullOrEmpty()] [string[]]$vpgName, [Parameter( - Mandatory = $true, + Mandatory, ParameterSetName = "vpgIdentifier", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, @@ -33,7 +33,7 @@ function Remove-ZertoVpg { begin { $baseUri = "vpgs" - $body = @{} + $body = @{ } if ($keepRecoveryVolumes) { $body['KeepRecoveryVolumes'] = $True } else { diff --git a/ZertoApiWrapper/Public/Remove-ZertoVpgSettingsIdentifier.ps1 b/ZertoApiWrapper/Public/Remove-ZertoVpgSettingsIdentifier.ps1 new file mode 100644 index 0000000..186e477 --- /dev/null +++ b/ZertoApiWrapper/Public/Remove-ZertoVpgSettingsIdentifier.ps1 @@ -0,0 +1,26 @@ +<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #> +function Remove-ZertoVpgSettingsIdentifier { + [CmdletBinding(SupportsShouldProcess = $true)] + param ( + # Settings Identifier to Remove + [Parameter(HelpMessage = "VpgSettingsIdentifier to Delete", Mandatory)] + [ValidateNotNullOrEmpty()] + [string[]] + $vpgSettingsIdentifier + ) + + begin { + } + + process { + foreach ($id in $vpgSettingsIdentifier) { + if ($PSCmdlet.ShouldProcess($id)) { + $uri = "vpgSettings/{0}" -f $id + Invoke-ZertoRestRequest -uri $uri -method "DELETE" + } + } + } + + end { + } +} diff --git a/ZertoApiWrapper/Public/Remove-ZertoVpgVm.ps1 b/ZertoApiWrapper/Public/Remove-ZertoVpgVm.ps1 new file mode 100644 index 0000000..2af5029 --- /dev/null +++ b/ZertoApiWrapper/Public/Remove-ZertoVpgVm.ps1 @@ -0,0 +1,53 @@ +<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #> +function Remove-ZertoVpgVm { + [CmdletBinding(SupportsShouldProcess, ConfirmImpact = "High")] + param ( + [Parameter( + Mandatory, + HelpMessage = "Name of the VPG that contains the VM you wish to remove", + ParameterSetName = "VpgName" + )] + [ValidateNotNullOrEmpty()] + [String]$VpgName, + [Parameter( + Mandatory, + HelpMessage = "Name of VM(s) to remove from the VPG" + )] + [ValidateNotNullOrEmpty()] + [String[]]$Vm + ) + + begin { + + } + + process { + $VpgData = Get-ZertoVpg -vpgName $VpgName + if (-not $VpgData) { + Write-Error "Unable to find Vpg with name $VpgName. Please check your parameters and try again." -ErrorAction Stop + } else { + $protectedVms = Get-ZertoProtectedVm -vpgName $VpgData.VpgName + } + $VmIdentifiers = foreach ($machine in ($vm | Select-Object -Unique)) { + if ($machine -in $protectedVms.VmName) { + $protectedVms.Where( { $_.VmName -like $machine }) | Select-Object -ExpandProperty VmIdentifier + } else { + Write-Warning "Virtual Machine: '$machine' is not found in Vpg: '$VpgName'. Check your parameters. Skipping $machine" + } + } + if ($VmIdentifiers.Count -gt 0 -and $PSCmdlet.ShouldProcess(($Vm | Select-Object -Unique), "Removing VM(s): $($Vm | Select-Object -Unique) from Vpg $VpgName")) { + $vpgSettingsIdentifier = New-ZertoVpgSettingsIdentifier -vpgIdentifier $VpgData.VpgIdentifier + foreach ($identifier in $VmIdentifiers) { + $url = "vpgSettings/{0}/vms/{1}" -f $vpgSettingsIdentifier, $identifier + Invoke-ZertoRestRequest -uri $url -method DELETE + } + Save-ZertoVpgSetting -vpgSettingsIdentifier $vpgSettingsIdentifier + } else { + Write-Warning "No VMs found to remove. Please check your parameters and try again." + } + } + + end { + + } +} diff --git a/ZertoApiWrapper/Public/Resume-ZertoVpg.ps1 b/ZertoApiWrapper/Public/Resume-ZertoVpg.ps1 index 24e1c8f..a1b10d7 100644 --- a/ZertoApiWrapper/Public/Resume-ZertoVpg.ps1 +++ b/ZertoApiWrapper/Public/Resume-ZertoVpg.ps1 @@ -4,7 +4,7 @@ function Resume-ZertoVpg { param( [Parameter( HelpMessage = "Name(s) of VPG(s) to resume replication", - Mandatory = $true + Mandatory )] [ValidateNotNullOrEmpty()] [string[]]$vpgName diff --git a/ZertoApiWrapper/Public/Save-ZertoVpgSetting.ps1 b/ZertoApiWrapper/Public/Save-ZertoVpgSetting.ps1 index 64c9127..3f7fed8 100644 --- a/ZertoApiWrapper/Public/Save-ZertoVpgSetting.ps1 +++ b/ZertoApiWrapper/Public/Save-ZertoVpgSetting.ps1 @@ -6,17 +6,25 @@ function Save-ZertoVpgSetting { param( [Parameter( HelpMessage = "VpgSettings Identifier to save", - Mandatory = $true, + Mandatory, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true )] [ValidateNotNullOrEmpty()] - [Alias("vpgSettingsId")] + [Alias("sid", "settingsIdentifier", "vpgSettingsId")] [string]$vpgSettingsIdentifier ) - $baseUri = "vpgsettings/{0}/commit" -f $vpgSettingsIdentifier - if ($PSCmdlet.ShouldProcess("Commiting VPG Settings with Settigns identifier $vpgSettingsIdentifier")) { - Invoke-ZertoRestRequest -uri $baseUri -method "POST" + Begin { + } + + Process { + $baseUri = "vpgsettings/{0}/commit" -f $vpgSettingsIdentifier + if ($PSCmdlet.ShouldProcess("Commiting VPG Settings with Settigns identifier $vpgSettingsIdentifier")) { + Invoke-ZertoRestRequest -uri $baseUri -method "POST" + } + } + + End { } } diff --git a/ZertoApiWrapper/Public/Set-ZertoAlert.ps1 b/ZertoApiWrapper/Public/Set-ZertoAlert.ps1 index 1969177..725dd5b 100644 --- a/ZertoApiWrapper/Public/Set-ZertoAlert.ps1 +++ b/ZertoApiWrapper/Public/Set-ZertoAlert.ps1 @@ -5,7 +5,7 @@ function Set-ZertoAlert { [Parameter( ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, - Mandatory = $true, + Mandatory, HelpMessage = "Alert identifier(s) to be dismissed or undismissed." )] [ValidateNotNullOrEmpty()] @@ -13,13 +13,13 @@ function Set-ZertoAlert { [string[]]$alertId, [Parameter( ParameterSetName = "dismiss", - Mandatory = $true, + Mandatory, HelpMessage = "Will dismiss the selected alert." )] [switch]$dismiss, [Parameter( ParameterSetName = "undismiss", - Mandatory = $true, + Mandatory, HelpMessage = "Will undismiss the selected alert." )] [switch]$undismiss diff --git a/ZertoApiWrapper/Public/Set-ZertoLicense.ps1 b/ZertoApiWrapper/Public/Set-ZertoLicense.ps1 index 6ce7e32..90fdd47 100644 --- a/ZertoApiWrapper/Public/Set-ZertoLicense.ps1 +++ b/ZertoApiWrapper/Public/Set-ZertoLicense.ps1 @@ -3,7 +3,7 @@ function Set-ZertoLicense { [cmdletbinding( SupportsShouldProcess = $true )] param ( [Parameter( - Mandatory = $true, + Mandatory, HelpMessage = "License Key to apply to the Zerto Virtual Manager" )] [ValidateNotNullOrEmpty()] @@ -12,11 +12,11 @@ function Set-ZertoLicense { begin { $baseUri = "license" - $body = @{"LicenseKey" = $licenseKey} + $body = @{"LicenseKey" = $licenseKey } } process { - if ($PSCmdlet.ShouldProcess()) { + if ($PSCmdlet.ShouldProcess("Applying License Key: $licenseKey to server: $($script:zvmServer)")) { Invoke-ZertoRestRequest -uri $baseUri -body $($body | ConvertTo-Json) -method "PUT" } } @@ -24,4 +24,4 @@ function Set-ZertoLicense { end { # Nothing to do } -} \ No newline at end of file +} diff --git a/ZertoApiWrapper/Public/Set-ZertoUserCredential.ps1 b/ZertoApiWrapper/Public/Set-ZertoUserCredential.ps1 new file mode 100644 index 0000000..110be91 --- /dev/null +++ b/ZertoApiWrapper/Public/Set-ZertoUserCredential.ps1 @@ -0,0 +1,35 @@ +<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #> +function Set-ZertoUserCredential { + [cmdletbinding( + SupportsShouldProcess, + ConfirmImpact = 'High' + )] + param( + [Parameter( + HelpMessage = "PSCredential Object that contains the username and password for the updated credentials.", + Mandatory + )] + [pscredential]$UserCredential + ) + + begin { + + } + + process { + $uri = '/localsite/virtualizationsettings' + $body = @{ + Credentials = @{ + UserName = $UserCredential.UserName + Password = $UserCredential.GetNetworkCredential().Password + } + } + if ( $PSCmdlet.ShouldProcess( $script:zvmServer, "Updating hypervisor service account credentials" )) { + Invoke-ZertoRestRequest -uri $uri -Method PUT -body ($body | ConvertTo-Json) + } + } + + end { + + } +} diff --git a/ZertoApiWrapper/Public/Start-ZertoCloneVpg.ps1 b/ZertoApiWrapper/Public/Start-ZertoCloneVpg.ps1 index 1678c8b..17f4919 100644 --- a/ZertoApiWrapper/Public/Start-ZertoCloneVpg.ps1 +++ b/ZertoApiWrapper/Public/Start-ZertoCloneVpg.ps1 @@ -4,7 +4,7 @@ function Start-ZertoCloneVpg { param( [Parameter( HelpMessage = "Name of the VPG you wish to clone.", - Mandatory = $true + Mandatory )] [ValidateNotNullOrEmpty()] [string]$vpgName, @@ -27,25 +27,32 @@ function Start-ZertoCloneVpg { ) begin { + + } + + process { $baseUri = "vpgs" $vpgInfo = Get-ZertoVpg -name $vpgName if ( -not $vpgInfo ) { Write-Error "VPG: $vpgName could not be found. Please check the name and try again." } $vpgIdentifier = $vpgInfo.vpgIdentifier + $body = @{ } if ( $PSBoundParameters.ContainsKey('datastoreName') ) { $recoverysiteIdentifier = $vpgInfo.recoverysite.identifier $recoverySiteDatastores = Get-ZertoVirtualizationSite -siteIdentifier $recoverysiteIdentifier -datastores - $datastoreIdentifier = $($recoverySiteDatastores | Where-Object {$_.datastoreName -like $datastoreName}).DatastoreIdentifier + $datastoreIdentifier = $($recoverySiteDatastores | Where-Object { $_.datastoreName -like $datastoreName }).DatastoreIdentifier if ( -not $datastoreIdentifier ) { Write-Error "Datastore: $datastoreName is not a valid datastore. Please check the name and try again." -ErrorAction Stop + } else { + $body['DatastoreIdentifier'] = $datastoreIdentifier } } if ( $PSBoundParameters.ContainsKey('vmName') ) { $vpgVmInformation = Get-ZertoProtectedVm -vpgName $vpgName [System.Collections.ArrayList]$vmIdentifiers = @() foreach ( $name in $vmName ) { - $selectedVm = $vpgVmInformation | Where-Object {$_.VmName.toLower() -eq $name.toLower()} + $selectedVm = $vpgVmInformation | Where-Object { $_.VmName.toLower() -eq $name.toLower() } if ($null -eq $selectedVm) { Write-Error "VM: $name NOT found in VPG $vpgName. Check the name and try again." -ErrorAction Stop } elseif ($vmIdentifiers.Contains($selectedVm.vmIdentifier.toString())) { @@ -55,32 +62,20 @@ function Start-ZertoCloneVpg { } } $body['VmIdentifiers'] = $vmIdentifiers - if ($checkpointIdentifier) { - $body['CheckpointIdentifier'] = $checkpointIdentifier - } } - } - - process { - $uri = "{0}/{1}/CloneStart" -f $baseUri, $vpgIdentifier - $body = [ordered]@{} if ( $PSBoundParameters.ContainsKey('checkpointIdentifier') ) { $body['checkpointId'] = $checkpointIdentifier } - if ( $datastoreIdentifier ) { - $body['DatastoreIdentifier'] = $datastoreIdentifier - } - if ( $vmIdentifiers ) { - $body['VmIdentifiers'] = $vmIdentifiers - } Write-Verbose $body + $uri = "{0}/{1}/CloneStart" -f $baseUri, $vpgIdentifier if ($PSCmdlet.ShouldProcess("Clone Vpg")) { Invoke-ZertoRestRequest -uri $uri -body $($body | ConvertTo-Json) -method "POST" + Write-Verbose "Call Submitted to $uri" + Write-Verbose "With the following information: $($body | ConvertTo-Json)" } } end { - Write-Verbose "Call Submitted to $uri" - Write-Verbose "With the following information: $($body | ConvertTo-Json)" + } } diff --git a/ZertoApiWrapper/Public/Start-ZertoFailoverTest.ps1 b/ZertoApiWrapper/Public/Start-ZertoFailoverTest.ps1 index ee044e3..9c3512d 100644 --- a/ZertoApiWrapper/Public/Start-ZertoFailoverTest.ps1 +++ b/ZertoApiWrapper/Public/Start-ZertoFailoverTest.ps1 @@ -4,7 +4,7 @@ function Start-ZertoFailoverTest { param( [Parameter( HelpMessage = "Name of VPG to failover test", - Mandatory = $true + Mandatory )] [ValidateNotNullOrEmpty()] [string]$vpgName, @@ -27,11 +27,12 @@ function Start-ZertoFailoverTest { if ( -not $vpgIdentifier) { Write-Error "VPG: $vpgName Not Found. Please check the name and try again!" -ErrorAction Stop } + $body = @{ } if ( $PSBoundParameters.ContainsKey('vmName') ) { $vpgVmInformation = Get-ZertoProtectedVm -vpgName $vpgName - [System.Collections.ArrayList]$vmIdentifiers = @() + $vmIdentifiers = [System.Collections.Generic.List[string]]::new() foreach ( $name in $vmName ) { - $selectedVm = $vpgVmInformation | Where-Object {$_.VmName.toLower() -eq $name.toLower()} + $selectedVm = $vpgVmInformation | Where-Object { $_.VmName.toLower() -eq $name.toLower() } if ($null -eq $selectedVm) { Write-Error "VM: $name NOT found in VPG $vpgName. Check the name and try again." -ErrorAction Stop } elseif ($vmIdentifiers.Contains($selectedVm.vmIdentifier.toString())) { diff --git a/ZertoApiWrapper/Public/Stop-ZertoCloneVpg.ps1 b/ZertoApiWrapper/Public/Stop-ZertoCloneVpg.ps1 index 6e78ade..f0d4bb5 100644 --- a/ZertoApiWrapper/Public/Stop-ZertoCloneVpg.ps1 +++ b/ZertoApiWrapper/Public/Stop-ZertoCloneVpg.ps1 @@ -4,7 +4,7 @@ function Stop-ZertoCloneVpg { param( [Parameter( HelpMessage = "Name of the VPG to stop cloning", - Mandatory = $true + Mandatory )] [ValidateNotNullOrEmpty()] [string]$vpgName diff --git a/ZertoApiWrapper/Public/Stop-ZertoFailoverTest.ps1 b/ZertoApiWrapper/Public/Stop-ZertoFailoverTest.ps1 index babb190..9b5774e 100644 --- a/ZertoApiWrapper/Public/Stop-ZertoFailoverTest.ps1 +++ b/ZertoApiWrapper/Public/Stop-ZertoFailoverTest.ps1 @@ -4,7 +4,7 @@ function Stop-ZertoFailoverTest { param( [Parameter( HelpMessage = "Name(s) of VPG(s) to stop testing.", - Mandatory = $true + Mandatory )] [ValidateNotNullOrEmpty()] [string[]]$vpgName, @@ -21,7 +21,7 @@ function Stop-ZertoFailoverTest { begin { $baseUri = "vpgs" - $body = @{"FailoverTestSuccess" = $failoverTestSuccess; "FailoverTestSummary" = $failoverTestSummary} + $body = @{"FailoverTestSuccess" = $failoverTestSuccess; "FailoverTestSummary" = $failoverTestSummary } } process { diff --git a/ZertoApiWrapper/Public/Suspend-ZertoVpg.ps1 b/ZertoApiWrapper/Public/Suspend-ZertoVpg.ps1 index c590859..09278e2 100644 --- a/ZertoApiWrapper/Public/Suspend-ZertoVpg.ps1 +++ b/ZertoApiWrapper/Public/Suspend-ZertoVpg.ps1 @@ -4,7 +4,7 @@ function Suspend-ZertoVpg { param( [Parameter( HelpMessage = "Name(s) of VPG(s) to pause replication", - Mandatory = $true + Mandatory )] [ValidateNotNullOrEmpty()] [string[]]$vpgName diff --git a/ZertoApiWrapper/Public/Uninstall-ZertoVra.ps1 b/ZertoApiWrapper/Public/Uninstall-ZertoVra.ps1 index b62f332..bd5c701 100644 --- a/ZertoApiWrapper/Public/Uninstall-ZertoVra.ps1 +++ b/ZertoApiWrapper/Public/Uninstall-ZertoVra.ps1 @@ -3,7 +3,7 @@ function Uninstall-ZertoVra { [cmdletbinding()] param( [Parameter( - Mandatory = $true, + Mandatory, HelpMessage = "Host Name attached to the VRA to be removed." )] [ValidateNotNullOrEmpty()] diff --git a/ZertoApiWrapper/Public/en-us/ZertoApiWrapper-help.xml b/ZertoApiWrapper/Public/en-us/ZertoApiWrapper-help.xml index 6ae1461..51251ea 100644 --- a/ZertoApiWrapper/Public/en-us/ZertoApiWrapper-help.xml +++ b/ZertoApiWrapper/Public/en-us/ZertoApiWrapper-help.xml @@ -150,7 +150,7 @@ Online Version: - https://github.com/wcarroll/ZertoApiWrapper/blob/master/docs/Add-ZertoPeerSite.md + https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Add-ZertoPeerSite.md Zerto REST API Peer Site End Point Documentation @@ -262,7 +262,7 @@ Online Version: - https://github.com/wcarroll/ZertoApiWrapper/blob/master/docs/Checkpoint-ZertoVpg.md + https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Checkpoint-ZertoVpg.md Zerto REST API VPG End Point Documentation @@ -421,7 +421,7 @@ Online Version: - https://github.com/wcarroll/ZertoApiWrapper/blob/master/docs/Connect-ZertoServer.md + https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Connect-ZertoServer.md Zerto REST API Session End Point Documentation @@ -492,7 +492,7 @@ Online Version: - https://github.com/wcarroll/ZertoApiWrapper/blob/master/docs/Disconnect-ZertoServer.md + https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Disconnect-ZertoServer.md Zerto REST API Session End Point Documentation @@ -746,7 +746,7 @@ Online Version: - https://github.com/wcarroll/ZertoApiWrapper/blob/master/docs/Edit-ZertoVra.md + https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Edit-ZertoVra.md Zerto REST API VRA End Point Documentation @@ -903,7 +903,7 @@ Online Version: - https://github.com/wcarroll/ZertoApiWrapper/blob/Master/docs/Export-ZertoVpg.md + https://github.com/ZertoPublic/ZertoApiWrapper/blob/Master/docs/Export-ZertoVpg.md Zerto REST API VPG Settings End Point Documentation @@ -1325,7 +1325,7 @@ Online Version: - https://github.com/wcarroll/ZertoApiWrapper/blob/master/docs/Get-ZertoAlert.md + https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZertoAlert.md Zerto REST API Alerts End Point Documentation @@ -1420,7 +1420,7 @@ Online Version: - https://github.com/wcarroll/ZertoApiWrapper/blob/master/docs/Get-ZertoDatastore.md + https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZertoDatastore.md Zerto REST API Datastore Information End Point Documentation @@ -1916,7 +1916,7 @@ Online Version: - https://github.com/wcarroll/ZertoApiWrapper/blob/master/docs/Get-ZertoEvent.md + https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZertoEvent.md Zerto REST API Events End Point Documentation @@ -1979,7 +1979,7 @@ Online Version: - https://github.com/wcarroll/ZertoApiWrapper/blob/master/docs/Get-ZertoLicense.md + https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZertoLicense.md Zerto REST API License Information @@ -2066,7 +2066,7 @@ Online Version: - https://github.com/wcarroll/ZertoApiWrapper/blob/master/docs/Get-ZertoLocalSite.md + https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZertoLocalSite.md Zerto REST API Local Site End Point Documentation @@ -2310,7 +2310,7 @@ Online Version: - https://github.com/wcarroll/ZertoApiWrapper/blob/master/docs/Get-ZertoPeerSite.md + https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZertoPeerSite.md Zerto REST API Peer Site End Point Documentation @@ -2663,7 +2663,7 @@ Online Version: - https://github.com/wcarroll/ZertoApiWrapper/blob/master/docs/Get-ZertoProtectedVm.md + https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZertoProtectedVm.md Zerto REST API Protected VMs End Point Documentation @@ -2926,7 +2926,7 @@ Online Version: - https://github.com/wcarroll/ZertoApiWrapper/blob/master/docs/Get-ZertoRecoveryReport.md + https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZertoRecoveryReport.md Zerto REST API Recovery Report End Point Documentation @@ -3399,7 +3399,7 @@ Online Version: - https://github.com/wcarroll/ZertoApiWrapper/blob/master/docs/Get-ZertoResourcesReport.md + https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZertoResourcesReport.md Zerto REST API Resources Report End Point Documentation @@ -3514,7 +3514,7 @@ Online Version: - https://github.com/wcarroll/ZertoApiWrapper/blob/master/docs/Get-ZertoServiceProfile.md + https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZertoServiceProfile.md Zerto REST API Service Profile End Point Documentation @@ -3782,7 +3782,7 @@ Online Version: - https://github.com/wcarroll/ZertoApiWrapper/blob/master/docs/Get-ZertoTask.md + https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZertoTask.md Zerto REST API Task End Point Documentation @@ -3845,7 +3845,7 @@ Online Version: - https://github.com/wcarroll/ZertoApiWrapper/blob/master/docs/Get-ZertoUnprotectedVm.md + https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZertoUnprotectedVm.md Zerto REST API Virtualization Sites End Point Documentation @@ -4332,7 +4332,7 @@ Online Version: - https://github.com/wcarroll/ZertoApiWrapper/blob/master/docs/Get-ZertoVirtualizationSite.md + https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZertoVirtualizationSite.md Zerto REST API Virtualization Sites End Point Documentation @@ -4530,7 +4530,7 @@ Online Version: - https://github.com/wcarroll/ZertoApiWrapper/blob/master/docs/Get-ZertoVolume.md + https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZertoVolume.md Zerto REST API Volumes End Point Documentation @@ -5221,7 +5221,7 @@ Online Version: - https://github.com/wcarroll/ZertoApiWrapper/blob/master/docs/Get-ZertoVpg.md + https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZertoVpg.md Zerto REST API VPG End Point Documentation @@ -6035,7 +6035,7 @@ Online Version: - https://github.com/wcarroll/ZertoApiWrapper/blob/master/docs/Get-ZertoVpgSetting.md + https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZertoVpgSetting.md Zerto REST API VPG Settings End Point Documentation @@ -6401,7 +6401,7 @@ Online Version: - https://github.com/wcarroll/ZertoApiWrapper/blob/master/docs/Get-ZertoVra.md + https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZertoVra.md Zerto REST API VRA End Point Documentation @@ -6496,7 +6496,7 @@ Online Version: - https://github.com/wcarroll/ZertoApiWrapper/blob/master/docs/Get-ZertoZorg.md + https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZertoZorg.md Zerto REST API ZOrg End Point Documentation @@ -6584,7 +6584,7 @@ Online Version: - https://github.com/wcarroll/ZertoApiWrapper/blob/master/docs/Get-ZertpZsspSession.md + https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZertpZsspSession.md Zerto REST API ZSSP Session End Point Documentation @@ -6672,7 +6672,7 @@ Online Version: - https://github.com/wcarroll/ZertoApiWrapper/blob/Master/docs/Import-ZertoVpg.md + https://github.com/ZertoPublic/ZertoApiWrapper/blob/Master/docs/Import-ZertoVpg.md Zerto REST API VPG Settings End Point Documentation @@ -7089,7 +7089,7 @@ Online Version: - https://github.com/wcarroll/ZertoApiWrapper/blob/master/docs/Install-ZertoVra.md + https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Install-ZertoVra.md Zerto REST API VRA End Point Documentation @@ -7386,7 +7386,7 @@ Online Version: - https://github.com/wcarroll/ZertoApiWrapper/blob/master/docs/Invoke-ZertoFailover.md + https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Invoke-ZertoFailover.md Zerto REST API VPG End Point Documentation @@ -7504,7 +7504,7 @@ Online Version: - https://github.com/wcarroll/ZertoApiWrapper/blob/master/docs/Invoke-ZertoFailoverCommit.md + https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Invoke-ZertoFailoverCommit.md Zerto REST API VPG End Point Documentation @@ -7592,7 +7592,7 @@ Online Version: - https://github.com/wcarroll/ZertoApiWrapper/blob/master/docs/Invoke-ZertoFailoverRollback.md + https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Invoke-ZertoFailoverRollback.md Zerto REST API VPG End Point Documentation @@ -7680,7 +7680,7 @@ Online Version: - https://github.com/wcarroll/ZertoApiWrapper/blob/master/docs/Invoke-ZertoForceSync.md + https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Invoke-ZertoForceSync.md Zerto REST API VPG End Point Documentation @@ -8046,7 +8046,7 @@ Online Version: - https://github.com/wcarroll/ZertoApiWrapper/blob/master/docs/Invoke-ZertoMove.md + https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Invoke-ZertoMove.md Zerto REST API VPG End Point Documentation @@ -8360,7 +8360,7 @@ Online Version: - https://github.com/wcarroll/ZertoApiWrapper/blob/master/docs/Invoke-ZertoMoveRollback.md + https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Invoke-ZertoMoveRollback.md Zerto REST API VPG End Point Documentation @@ -10299,7 +10299,7 @@ Online Version: - https://github.com/wcarroll/ZertoApiWrapper/blob/master/docs/New-ZertoVpg.md + https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/New-ZertoVpg.md Zerto REST API VPG Settings End Point Documentation @@ -10488,7 +10488,7 @@ Online Version: - https://github.com/wcarroll/ZertoApiWrapper/blob/Master/docs/New-ZertoVpgSettingsIdentifier.md + https://github.com/ZertoPublic/ZertoApiWrapper/blob/Master/docs/New-ZertoVpgSettingsIdentifier.md Zerto REST API VPG Settings End Point Documentation @@ -10761,7 +10761,7 @@ Online Version: - https://github.com/wcarroll/ZertoApiWrapper/blob/master/docs/Remove-ZertoPeerSite.md + https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Remove-ZertoPeerSite.md Zerto REST API Peer Site End Point Documentation @@ -11033,7 +11033,7 @@ Online Version: - https://github.com/wcarroll/ZertoApiWrapper/blob/master/docs/Remove-ZertoVpg.md + https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Remove-ZertoVpg.md Zerto REST API VPG End Point Documentation @@ -11121,7 +11121,7 @@ Online Version: - https://github.com/wcarroll/ZertoApiWrapper/blob/master/docs/Resume-ZertoVpg.md + https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Resume-ZertoVpg.md Zerto REST API VPG End Point Documentation @@ -11255,7 +11255,7 @@ Online Version: - https://github.com/wcarroll/ZertoApiWrapper/blob/master/docs/Save-ZertoVpgSetting.md + https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Save-ZertoVpgSetting.md Zerto REST API VPG Settings End Point Documentation @@ -11479,7 +11479,7 @@ Online Version: - https://github.com/wcarroll/ZertoApiWrapper/blob/master/docs/Set-ZertoAlert.md + https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Set-ZertoAlert.md Zerto REST API Alerts End Point Documentation @@ -11613,7 +11613,7 @@ Online Version: - https://github.com/wcarroll/ZertoApiWrapper/blob/master/docs/Set-ZertoLicense.md + https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Set-ZertoLicense.md Zerto REST API License Information @@ -11819,7 +11819,7 @@ Online Version: - https://github.com/wcarroll/ZertoApiWrapper/blob/master/docs/Start-ZertoCloneVpg.md + https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Start-ZertoCloneVpg.md Zerto REST API VPG End Point Documentation @@ -12001,7 +12001,7 @@ Online Version: - https://github.com/wcarroll/ZertoApiWrapper/blob/master/docs/Start-ZertoFailoverTest.md + https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Start-ZertoFailoverTest.md Zerto REST API VPG End Point Documentation @@ -12135,7 +12135,7 @@ Online Version: - https://github.com/wcarroll/ZertoApiWrapper/blob/master/docs/Stop-ZertoCloneVpg.md + https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Stop-ZertoCloneVpg.md Zerto REST API VPG End Point Documentation @@ -12317,7 +12317,7 @@ Online Version: - https://github.com/wcarroll/ZertoApiWrapper/blob/master/docs/Stop-ZertoFailoverTest.md + https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Stop-ZertoFailoverTest.md Zerto REST API VPG End Point Documentation @@ -12405,7 +12405,7 @@ Online Version: - https://github.com/wcarroll/ZertoApiWrapper/blob/master/docs/Suspend-ZertoVpg.md + https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Suspend-ZertoVpg.md Zerto REST API VPG End Point Documentation @@ -12493,7 +12493,7 @@ Online Version: - https://github.com/wcarroll/ZertoApiWrapper/blob/master/docs/Uninstall-ZertoVra.md + https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Uninstall-ZertoVra.md Zerto REST API VRA End Point Documentation @@ -12501,4 +12501,4 @@ - \ No newline at end of file + diff --git a/ZertoApiWrapper/ZertoApiWrapper.psd1 b/ZertoApiWrapper/ZertoApiWrapper.psd1 index c86a32b..44754ec 100644 --- a/ZertoApiWrapper/ZertoApiWrapper.psd1 +++ b/ZertoApiWrapper/ZertoApiWrapper.psd1 @@ -33,7 +33,7 @@ Description = 'PowerShell Core Wrapper Module for Zerto Virtual Manager API' # Minimum version of the PowerShell engine required by this module - PowerShellVersion = '6.0.0' + PowerShellVersion = '5.1.0' # Name of the PowerShell host required by this module # PowerShellHostName = '' @@ -69,7 +69,7 @@ # NestedModules = @() # Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export. - FunctionsToExport = 'Add-ZertoPeerSite', 'Checkpoint-ZertoVpg', 'Connect-ZertoServer', 'Disconnect-ZertoServer', 'Edit-ZertoVra', 'Export-ZertoVpg', 'Get-ZertoAlert', 'Get-ZertoDatastore', 'Get-ZertoEvent', 'Get-ZertoLicense', 'Get-ZertoLocalSite', 'Get-ZertoPeerSite', 'Get-ZertoProtectedVm', 'Get-ZertoRecoveryReport', 'Get-ZertoResourcesReport', 'Get-ZertoServiceProfile', 'Get-ZertoTask', 'Get-ZertoUnprotectedVm', 'Get-ZertoVirtualizationSite', 'Get-ZertoVolume', 'Get-ZertoVpg', 'Get-ZertoVpgSetting', 'Get-ZertoVra', 'Get-ZertoZorg', 'Get-ZertoZsspSession', 'Import-ZertoVpg', 'Install-ZertoVra', 'Invoke-ZertoFailover', 'Invoke-ZertoFailoverCommit', 'Invoke-ZertoFailoverRollback', 'Invoke-ZertoForceSync', 'Invoke-ZertoMove', 'Invoke-ZertoMoveCommit', 'Invoke-ZertoMoveRollback', 'New-ZertoVpg', 'New-ZertoVpgSettingsIdentifier', 'Remove-ZertoPeerSite', 'Remove-ZertoVpg', 'Resume-ZertoVpg', 'Save-ZertoVpgSettings', 'Set-ZertoAlert', 'Set-ZertoLicense', 'Start-ZertoCloneVpg', 'Start-ZertoFailoverTest', 'Stop-ZertoCloneVpg', 'Stop-ZertoFailoverTest', 'Suspend-ZertoVpg', 'Uninstall-ZertoVra' + FunctionsToExport = '*' # Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export. CmdletsToExport = @() diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 46201e1..b20a9a2 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -5,89 +5,101 @@ name: $(TeamProject)_$(SourceBranchName)_$(Date:yyyyMMdd)$(Rev:.rr) -# Trigger CI on commit to master and develop branches +# Trigger CI on commit to master branch trigger: branches: include: - master - - develop - - TestingBranch + - PowerShellBackPort + - Refactor-Build # Trigger CI on pull requests to master and develop branches pr: - master - - develop - - TestingBranch jobs: - # Windows Build Job - - job: Build_PS_Win2016 + # Windows PowerShell 5.1 Build Job + - job: Build_PS_Windows timeoutInMinutes: 10 cancelTimeoutInMinutes: 2 pool: - vmImage: vs2017-win2016 + vmImage: windows-latest steps: - # Run build.ps1 script in PowerShell Core - - pwsh: | - .\build.ps1 -Verbose - displayName: 'Build and Test' - # Upload test results to Azure Pipeline - - task: PublishTestResults@2 - inputs: - testRunner: 'NUnit' - testResultsFiles: '**/TestResults.xml' - testRunTitle: 'PS_Win2016' - displayName: 'Publish Test Results' - condition: always() + # Run build.ps1 script in PowerShell Core + - powershell: | + .\build.ps1 -Verbose + displayName: "Build and Test" + # Upload test results to Azure Pipeline + - task: PublishTestResults@2 + inputs: + testRunner: "NUnit" + testResultsFiles: "**/BuiltTestResults.xml" + testRunTitle: "PS_Win2016_Built" + displayName: "Publish Test Results" + condition: always() + + # Windows PowerShell Core Build Job + - job: Build_PSCore_Windows + timeoutInMinutes: 10 + cancelTimeoutInMinutes: 2 + pool: + vmImage: windows-latest + steps: + # Run build.ps1 script in PowerShell Core + - pwsh: | + .\build.ps1 -Verbose + displayName: "Build and Test" + # Upload test results to Azure Pipeline + - task: PublishTestResults@2 + inputs: + testRunner: "NUnit" + testResultsFiles: "**/BuiltTestResults.xml" + testRunTitle: "PSCore_Win2016_Built" + displayName: "Publish Test Results" + condition: always() # Linux Build Job - - job: Build_PSCore_Ubuntu1604 + - job: Build_PSCore_Ubuntu timeoutInMinutes: 10 cancelTimeoutInMinutes: 2 pool: - vmImage: ubuntu-16.04 + vmImage: ubuntu-latest steps: - # Run build.ps1 script in PowerShell Core - - pwsh: | - .\build.ps1 -verbose - displayName: 'Build and Test' - # Upload test results to Azure Pipeline - - task: PublishTestResults@2 - inputs: - testRunner: 'NUnit' - testResultsFiles: '**/TestResults.xml' - testRunTitle: 'PSCore_Ubuntu1604' - displayName: 'Publish Test Results' - condition: always() - - task: PublishPipelineArtifact@0 - displayName: 'Publish compiled module Artifact' - inputs: - artifactName: 'ZertoApiWrapper' - targetPath: ./temp - condition: always() - - task: PublishPipelineArtifact@0 - displayName: 'Publish Data' - inputs: - artifactName: 'ReleaseData' - targetPath: ./publish - condition: always() + # Run build.ps1 script in PowerShell Core + - pwsh: | + .\build.ps1 -verbose + displayName: "Build and Test" + # Upload test results to Azure Pipeline + - task: PublishTestResults@2 + inputs: + testRunner: "NUnit" + testResultsFiles: "**/BuiltTestResults.xml" + testRunTitle: "PSCore_Ubuntu_Built" + displayName: "Publish Test Results" + condition: always() + - task: PublishPipelineArtifact@1 + displayName: "Publish Data" + inputs: + artifactName: "ReleaseData" + targetPath: ./publish + condition: always() # MacOS Build Job - - job: Build_PSCore_MacOS1013 + - job: Build_PSCore_MacOS timeoutInMinutes: 10 cancelTimeoutInMinutes: 2 pool: - vmImage: xcode9-macos10.13 + vmImage: macOS-latest steps: - # Run build.ps1 script in PowerShell Core - - pwsh: | - .\build.ps1 -verbose - displayName: 'Build and Test' - # Upload test results to Azure Pipeline - - task: PublishTestResults@2 - inputs: - testRunner: 'NUnit' - testResultsFiles: '**/TestResults.xml' - testRunTitle: 'PSCore_MacOS1013' - displayName: 'Publish Test Results' - condition: always() + # Run build.ps1 script in PowerShell Core + - pwsh: | + .\build.ps1 -verbose + displayName: "Build and Test" + # Upload test results to Azure Pipeline + - task: PublishTestResults@2 + inputs: + testRunner: "NUnit" + testResultsFiles: "**/BuiltTestResults.xml" + testRunTitle: "PSCore_MacOS1013_Built" + displayName: "Publish Test Results" + condition: always() diff --git a/build.ps1 b/build.ps1 index 9ce90cf..2f2c873 100644 --- a/build.ps1 +++ b/build.ps1 @@ -1,3 +1,5 @@ +param([validateSet("build", "release")]$operation = "build") + # Bootstrap the environment $null = Get-PackageProvider -Name NuGet -ForceBootstrap @@ -11,6 +13,7 @@ Invoke-PSDepend ` -Force ` -Import ` -Install ` - -Tags 'Bootstrap' + -Tags 'Bootstrap' ` + -ErrorAction Continue -Invoke-Build . +Invoke-Build $operation diff --git a/docs/Add-ZertoPeerSite.md b/docs/Add-ZertoPeerSite.md index c05f0ef..72d82c2 100644 --- a/docs/Add-ZertoPeerSite.md +++ b/docs/Add-ZertoPeerSite.md @@ -1,7 +1,7 @@ --- external help file: ZertoApiWrapper-help.xml Module Name: ZertoApiWrapper -online version: https://github.com/wcarroll/ZertoApiWrapper/blob/master/docs/Add-ZertoPeerSite.md +online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Add-ZertoPeerSite.md schema: 2.0.0 --- @@ -13,7 +13,8 @@ Pairs the current Zerto Virtual Manager to the target Zerto Virtual Manager ## SYNTAX ``` -Add-ZertoPeerSite [-targetHost] [[-targetPort] ] [-WhatIf] [-Confirm] [] +Add-ZertoPeerSite [-targetHost] [[-targetPort] ] [-token ] [-WhatIf] [-Confirm] + [] ``` ## DESCRIPTION @@ -23,10 +24,17 @@ Pairs the current Zerto Virtual Manager to the target Zerto Virtual Manager by l ### Example 1 ```powershell -PS C:\> Add-ZertoPeerSite -targetHost "192.168.2.100" -targetPort "9081" +PS C:\> Add-ZertoPeerSite -targetHost "192.168.2.100" ``` -Pairs the current Zerto Virtual Manager to the Zerto Virtual Manager at IP address 192.168.2.100. +Pairs the current Zerto Virtual Manager to the Zerto Virtual Manager at IP address 192.168.2.100. Use this method when pairing Zerto Virtual Managers that are prior to version 7.5 + +### Example 2 +```powershell +PS C:\> Add-ZertoPeerSite -targetHost "192.168.2.100" -targetPort "9071" -token "GeneratedFromTargetZVM" +``` + +Pairs the current Zerto Virtual Manager to the Zerto Virtual Manager at IP address 192.168.2.100 over Port 9071. Use this method when pairing Zerto Virtual Managers that are version 7.5 or later. ## PARAMETERS @@ -61,6 +69,21 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -token +The generated token from the destination site. Note: This is only supported when both sites support pairing authentication. This was implemented to support ZVR 7.5 and later. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### -Confirm Prompts you for confirmation before running the cmdlet. diff --git a/docs/Add-ZertoVpgVm.md b/docs/Add-ZertoVpgVm.md new file mode 100644 index 0000000..5997286 --- /dev/null +++ b/docs/Add-ZertoVpgVm.md @@ -0,0 +1,138 @@ +--- +external help file: ZertoApiWrapper-help.xml +Module Name: ZertoApiWrapper +online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Add-ZertoVpgVm.md +schema: 2.0.0 +--- + +# Add-ZertoVpgVm + +## SYNOPSIS +Adds one or more virtual machines to an existing VPG. A VPG Settings Identifier will be returned for use in either further customization of the VPG or passed to the `Save-ZertoVpgSetting` command to commit the changes. + +## SYNTAX + +### VpgName (Default) +``` +Add-ZertoVpgVm -VpgName -Vm [-WhatIf] [-Confirm] [] +``` + +### VpgSettingsIdentifier +``` +Add-ZertoVpgVm -vpgSettingsIdentifier -Vm [-WhatIf] [-Confirm] [] +``` + +## DESCRIPTION +Adds one or more virtual machines to an existing VPG. A VPG Settings Identifier will be returned for use in either further customization of the VPG or passed to the `Save-ZertoVpgSetting` command to commit the changes. + +Internal logic to the function will only process unique items and ensure that VMs meet requirements to replicate to the target site. These requirements include not currently a member of the specified VPG, not currently replicating to the target site, and not a member of 3 or more VPGs. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> Add-ZertoVpgVm -VpgSettingsIdentifier $vpgSettingsIdentifier -Vm "VM 1", "Vm 2" +``` + +Adds "VM 1" and "VM 2" to the Vpg with VpgSettingsIdentifer specified in `$VpgSettingsIdentifier`. This variable was obtained via other functions that create and return a Vpg Settings Identifier. The Vpg Settings Identifier passed into the function will be returned. + +### Example 2 +```powershell +PS C:\> Add-ZertoVpgVm -VpgName "My Vpg" -Vm "VM 1", "Vm 2" +``` + +Adds "VM 1" and "VM 2" to the Vpg named "My Vpg". In this case, a new Vpg Settings Identifier will be created and returned. + +## PARAMETERS + +### -Vm +Name of VM(s) to add to the VPG + +```yaml +Type: String[] +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -VpgName +Target VPG Name to Add the VM + +```yaml +Type: String +Parameter Sets: VpgName +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -vpgSettingsIdentifier +Vpg Settings Identifier + +```yaml +Type: String +Parameter Sets: VpgSettingsIdentifier +Aliases: sid, settingsIdentifier, vpgSettingsId + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByPropertyName, ByValue) +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### System.String + +## OUTPUTS + +### System.Object + +## NOTES + +## RELATED LINKS +[Adding VMs to a VPG Settings Object](https://s3.amazonaws.com/zertodownload_docs/Latest/Zerto%20Virtual%20Replication%20Zerto%20Virtual%20Manager%20(ZVM)%20-%20vSphere%20Online%20Help/content/zvr_apis/vpg_management_api.htm?tocpath=ZVR%20RESTful%20APIs%7CZerto%20APIs%7C_____20#statusapis_4057192544_1358357) diff --git a/docs/Checkpoint-ZertoVpg.md b/docs/Checkpoint-ZertoVpg.md index 3c08107..7951d3c 100644 --- a/docs/Checkpoint-ZertoVpg.md +++ b/docs/Checkpoint-ZertoVpg.md @@ -1,7 +1,7 @@ --- external help file: ZertoApiWrapper-help.xml Module Name: ZertoApiWrapper -online version: https://github.com/wcarroll/ZertoApiWrapper/blob/master/docs/Checkpoint-ZertoVpg.md +online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Checkpoint-ZertoVpg.md schema: 2.0.0 --- @@ -13,7 +13,7 @@ Add a tagged checkpoint to a specified VPG ## SYNTAX ``` -Checkpoint-ZertoVpg [-vpgName] [-checkpointName] [] +Checkpoint-ZertoVpg [-vpgName] [-checkpointName] [] ``` ## DESCRIPTION @@ -49,14 +49,14 @@ Accept wildcard characters: False Name of the VPG to tag. ```yaml -Type: String +Type: String[] Parameter Sets: (All) Aliases: Required: True Position: 0 Default value: None -Accept pipeline input: False +Accept pipeline input: True (ByPropertyName, ByValue) Accept wildcard characters: False ``` diff --git a/docs/Connect-ZertoAnalytics.md b/docs/Connect-ZertoAnalytics.md new file mode 100644 index 0000000..0c30a0d --- /dev/null +++ b/docs/Connect-ZertoAnalytics.md @@ -0,0 +1,61 @@ +--- +external help file: ZertoApiWrapper-help.xml +Module Name: ZertoApiWrapper +online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Connect-ZertoAnalytics.md +schema: 2.0.0 +--- + +# Connect-ZertoAnalytics + +## SYNOPSIS +All requests to the server, apart from the request to authenticate, must contain a security token which is provided on successful authentication. +In order to authenticate, the user sends myZerto credentials (user/password). + +## SYNTAX + +``` +Connect-ZertoAnalytics [-credential] [] +``` + +## DESCRIPTION +All requests to the server, apart from the request to authenticate, must contain a security token which is provided on successful authentication. +In order to authenticate, the user sends myZerto credentials (user/password). Once this call has been completed successfully, the header authentication token will be stored as a variable and automatically passed during future calls to the Zerto Analytics platform. This token will automatically expire after 60 minutes of inactivity and need to be reauthorized by calling this function again. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> Connect-ZertoAnalytics -credential $myCredential +``` + +Connects to the Zerto Analytics site and gets a Bearer Authorization token that is automatically stored as a variable for future calls to the Zerto Analytics REST API. This token will automatically expire after 60 minutes of inactivity and need to be reauthorized by calling this function again. + +## PARAMETERS + +### -credential +PSCredential Object containing username and password authorized for the Zerto Analytics site + +```yaml +Type: PSCredential +Parameter Sets: (All) +Aliases: + +Required: True +Position: 1 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +## NOTES + +## RELATED LINKS + +[Zerto Analytics REST API Endpoint for Authentication](https://docs.api.zerto.com/#/Authentication/post_v2_auth_token) diff --git a/docs/Connect-ZertoServer.md b/docs/Connect-ZertoServer.md index 810bdb0..9a08e8d 100644 --- a/docs/Connect-ZertoServer.md +++ b/docs/Connect-ZertoServer.md @@ -1,110 +1,135 @@ ---- -external help file: ZertoApiWrapper-help.xml -Module Name: ZertoApiWrapper -online version: https://github.com/wcarroll/ZertoApiWrapper/blob/master/docs/Connect-ZertoServer.md -schema: 2.0.0 ---- - -# Connect-ZertoServer - -## SYNOPSIS -Establishes a connection to a ZVM. - -## SYNTAX - -``` -Connect-ZertoServer [-zertoServer] [[-zertoPort] ] [-credential] - [-returnHeaders] [] -``` - -## DESCRIPTION -Establishes a connection to a ZVM using credentials provided via a PSCredential Object leveraging the Zerto Session API end point. - -## EXAMPLES - -### Example 1 -```powershell -PS C:\> Connect-ZertoServer -zertoServer "192.168.1.100" -zertoPort "9669" -credential $credential -``` - -Establishes a connection to ZVM 192.168.1.100 on port 9669 with supplied PSCredential object. - -## PARAMETERS - -### -credential -Valid credentials to connect to the Zerto Management Server - -```yaml -Type: PSCredential -Parameter Sets: (All) -Aliases: - -Required: True -Position: 2 -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - -### -returnHeaders -Use this switch to return the headers to a specified variable or to the default output. - -```yaml -Type: SwitchParameter -Parameter Sets: (All) -Aliases: - -Required: False -Position: Named -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - -### -zertoPort -Zerto Virtual Manager management port. -Default value is 9669. - -```yaml -Type: String -Parameter Sets: (All) -Aliases: port - -Required: False -Position: 1 -Default value: "9669" -Accept pipeline input: False -Accept wildcard characters: False -``` - -### -zertoServer -IP address or FQDN of your Zerto Management Server - -```yaml -Type: String -Parameter Sets: (All) -Aliases: server, zvm - -Required: True -Position: 0 -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - -### CommonParameters -This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). - -## INPUTS - -### None -## OUTPUTS - -### System.Object -## NOTES - -## RELATED LINKS - -[Zerto REST API Session End Point Documentation](http://s3.amazonaws.com/zertodownload_docs/Latest/Zerto%20Virtual%20Replication%20Zerto%20Virtual%20Manager%20%28ZVM%29%20-%20vSphere%20Online%20Help/index.html#page/RestfulAPIs%2FStatusAPIs.5.068.html%23) -[PSCredential Documentation](https://docs.microsoft.com/en-us/dotnet/api/system.management.automation.pscredential?view=pscore-6.0.0) -[Get-Credential Documentation](https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.security/get-credential?view=powershell-6) +--- +external help file: ZertoApiWrapper-help.xml +Module Name: ZertoApiWrapper +online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Connect-ZertoServer.md +schema: 2.0.0 +--- + +# Connect-ZertoServer + +## SYNOPSIS +Establishes a connection to a ZVM. + +## SYNTAX + +``` +Connect-ZertoServer [-zertoServer] [-credential] [-zertoPort ] [-AutoReconnect] + [-returnHeaders] [] +``` + +## DESCRIPTION +Establishes a connection to a ZVM using credentials provided via a PSCredential Object leveraging the Zerto Session API end point. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> Connect-ZertoServer -zertoServer "192.168.1.100" -zertoPort "9669" -credential $credential +``` + +Establishes a connection to ZVM 192.168.1.100 on port 9669 with supplied PSCredential object. + +### Example 2 +```powershell +PS C:\> Connect-ZertoServer -zertoServer "192.168.1.100" -zertoPort "9669" -credential $credential -AutoReconnect +``` + +Establishes a connection to ZVM 192.168.1.100 on port 9669 with supplied PSCredential object. Adding the `-AutoReconnect` switch +will cache the PSCredential object should the session need to be reauthorized due to an expired token. + +## PARAMETERS + +### -AutoReconnect +Use this switch to indicate that you would like the module to take care of auto re-authorization and reconnection to the ZVM should the token expire. This option will cache your PSCredential object to be reused + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -credential +Valid credentials to connect to the Zerto Management Server + +```yaml +Type: PSCredential +Parameter Sets: (All) +Aliases: + +Required: True +Position: 1 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -returnHeaders +Use this switch to return the headers to a specified variable or to the default output. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -zertoPort +Zerto Virtual Manager management port. +Default value is 9669. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: port + +Required: False +Position: Named +Default value: "9669" +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -zertoServer +IP address or FQDN of your Zerto Management Server + +```yaml +Type: String +Parameter Sets: (All) +Aliases: server, zvm + +Required: True +Position: 0 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### None +## OUTPUTS + +### System.Object +## NOTES + +## RELATED LINKS + +[Zerto REST API Session End Point Documentation](http://s3.amazonaws.com/zertodownload_docs/Latest/Zerto%20Virtual%20Replication%20Zerto%20Virtual%20Manager%20%28ZVM%29%20-%20vSphere%20Online%20Help/index.html#page/RestfulAPIs%2FStatusAPIs.5.068.html%23) + +[PSCredential Documentation](https://docs.microsoft.com/en-us/dotnet/api/system.management.automation.pscredential?view=pscore-6.0.0) + +[Get-Credential Documentation](https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.security/get-credential?view=powershell-6) diff --git a/docs/Copy-ZertoVpg.md b/docs/Copy-ZertoVpg.md new file mode 100644 index 0000000..9981fcf --- /dev/null +++ b/docs/Copy-ZertoVpg.md @@ -0,0 +1,127 @@ +--- +external help file: ZertoApiWrapper-help.xml +Module Name: ZertoApiWrapper +online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Copy-ZertoVpg.md +schema: 2.0.0 +--- + +# Copy-ZertoVpg + +## SYNOPSIS +Copy an existing VPG settings object to create a new VPG with the same settings. New VMs must be added to the copied VPG. + +## SYNTAX + +``` +Copy-ZertoVpg [-SourceVpgName] [-NewVpgName] [-VMs] [-WhatIf] [-Confirm] + [] +``` + +## DESCRIPTION +Copy an existing VPG settings object to create a new VPG with the same settings. New VMs must be added to the copied VPG. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> Copy-ZertoVpg -SourceVpgName 'MyVpg' -NewVpgName 'MyNewVpg' -VMs 'VmToAdd01' +``` + +Copies the settings of 'MyVpg' into a new VPG 'MyNewVpg' adding one VM, 'VmToAdd01' + +### Example 2 +```powershell +PS C:\> Copy-ZertoVpg -SourceVpgName 'MyVpg' -NewVpgName 'MyNewVpg' -VMs 'VmToAdd01', 'VmToAdd02' +``` + +Copies the settings of 'MyVpg' into a new VPG 'MyNewVpg' adding two VMs, 'VmToAdd01' and 'VmToAdd02' + +## PARAMETERS + +### -NewVpgName +Name to assign the newly created VPG + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: 2 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SourceVpgName +Name of the VPG to clone + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: 1 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -VMs +Name of VMs to add to the VPG + +```yaml +Type: String[] +Parameter Sets: (All) +Aliases: + +Required: True +Position: 3 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. The cmdlet is not run. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +## NOTES + +## RELATED LINKS + +[Zerto Clone VPG API Endpoint Documentation](http://s3.amazonaws.com/zertodownload_docs/Latest/Zerto%20Virtual%20Replication%20Zerto%20Virtual%20Manager%20%28ZVM%29%20-%20vSphere%20Online%20Help/index.html#page/RestfulAPIs%2FStatusAPIs.5.119.html%23) diff --git a/docs/Disconnect-ZertoServer.md b/docs/Disconnect-ZertoServer.md index 814d8cc..9cb7188 100644 --- a/docs/Disconnect-ZertoServer.md +++ b/docs/Disconnect-ZertoServer.md @@ -1,7 +1,7 @@ --- external help file: ZertoApiWrapper-help.xml Module Name: ZertoApiWrapper -online version: https://github.com/wcarroll/ZertoApiWrapper/blob/master/docs/Disconnect-ZertoServer.md +online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Disconnect-ZertoServer.md schema: 2.0.0 --- diff --git a/docs/Edit-ZertoVra.md b/docs/Edit-ZertoVra.md index be40e81..a34332a 100644 --- a/docs/Edit-ZertoVra.md +++ b/docs/Edit-ZertoVra.md @@ -1,20 +1,20 @@ --- external help file: ZertoApiWrapper-help.xml Module Name: ZertoApiWrapper -online version: https://github.com/wcarroll/ZertoApiWrapper/blob/master/docs/Edit-ZertoVra.md +online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Edit-ZertoVra.md schema: 2.0.0 --- # Edit-ZertoVra ## SYNOPSIS -Updates a VRA with updated settings +Updates a VRA with updated settings. Use of this function will cause a reboot of the associated VRA. ## SYNTAX ``` Edit-ZertoVra -vraIdentifier [-groupName ] [-vraIpAddress ] [-defaultGateway ] - [-subnetMask ] [-WhatIf] [-Confirm] [] + [-subnetMask ] [-HostRootPassword ] [-WhatIf] [-Confirm] [] ``` ## DESCRIPTION @@ -24,6 +24,8 @@ It is possible to update the Bandwidth group with the -groupName setting. If the It is possible to update the static IP address, default gateway, or subnetmask. +This function can be used if the VRA was installed with host credentials to update the password to connect to the host if it has changed. + It is suggested that you use Get-ZertoVra to get the vraIdentifer parameter. ## EXAMPLES @@ -49,13 +51,20 @@ PS C:\>Edit-ZertoVra -vraIdentifier $vraIdentifier -vraIpAddress "192.168.1.101" Updates the VRA IP address to 192.168.1.101, subnet mask to 255.255.252.0, and default gateway to 192.168.1.1 -### Example 3 +### Example 4 ```powershell PS C:\>Edit-ZertoVra -vraIdentifier $vraIdentifier -defaultGateway "192.168.1.1" ``` Updates the VRA default gateway to 192.168.1.1 +### Example 5 +```powershell +PS C:\>Edit-ZertoVra -HostRootPassword $HostRootPassword +``` + +Updates the VRA default gateway to 192.168.1.1 + ## PARAMETERS ### -defaultGateway @@ -89,6 +98,21 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -HostRootPassword +Updated ESXi host root password. + +```yaml +Type: SecureString +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### -subnetMask Subnetmask to be assigned to the VRA diff --git a/docs/Export-ZertoVmNicSetting.md b/docs/Export-ZertoVmNicSetting.md new file mode 100644 index 0000000..fe9268b --- /dev/null +++ b/docs/Export-ZertoVmNicSetting.md @@ -0,0 +1,79 @@ +--- +external help file: ZertoApiWrapper-help.xml +Module Name: ZertoApiWrapper +online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/Master/docs/Export-ZertoVmNicSettings.md +schema: 2.0.0 +--- + +# Export-ZertoVmNicSetting + +## SYNOPSIS +Queries VPGs and associated Virtual Machines to export all protected virtual machine NIC settings to a Comma Separated Value (CSV) file. + +## SYNTAX + +``` +Export-ZertoVmNicSetting [[-VpgName] ] [-OutputFile] [] +``` + +## DESCRIPTION +Queries VPGs and associated Virtual Machines to export all protected virtual machine NIC settings to a Comma Separated Value (CSV) file. This file can be used with the Import-ZertoVmNicSetting function to bulk update. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> Export-ZertoVmNicSetting -OutputFile "C:\ZertoInfo\VMNicSettings.csv" +``` + +Exports VM Nic Settings for ALL Virtual Protection Groups to a file located at "C:\ZertoInfo\VMNicSettings.csv" + +### Example 2 +```powershell +PS C:\> Export-ZertoVmNicSetting -OutputFile "C:\ZertoInfo\VMNicSettings.csv" -VpgName "Exchange", "Support Forum" +``` + +Exports VM Nic Settings for Exchange and Support Forum Virtual Protection Groups to a file located at "C:\ZertoInfo\VMNicSettings.csv" + +## PARAMETERS + +### -OutputFile +Output file information + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: 2 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -VpgName +Vpg(s) to export. If no VPG was named, all data will be exported. + +```yaml +Type: String[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: 1 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +## NOTES + +## RELATED LINKS diff --git a/docs/Export-ZertoVpg.md b/docs/Export-ZertoVpg.md index 52e6dc5..8a1ee4c 100644 --- a/docs/Export-ZertoVpg.md +++ b/docs/Export-ZertoVpg.md @@ -1,7 +1,7 @@ --- external help file: ZertoApiWrapper-help.xml Module Name: ZertoApiWrapper -online version: https://github.com/wcarroll/ZertoApiWrapper/blob/Master/docs/Export-ZertoVpg.md +online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/Master/docs/Export-ZertoVpg.md schema: 2.0.0 --- diff --git a/docs/Get-ZAAlert.md b/docs/Get-ZAAlert.md new file mode 100644 index 0000000..ae37647 --- /dev/null +++ b/docs/Get-ZAAlert.md @@ -0,0 +1,125 @@ +--- +external help file: ZertoApiWrapper-help.xml +Module Name: ZertoApiWrapper +online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZAAlert.md +schema: 2.0.0 +--- + +# Get-ZAAlert + +## SYNOPSIS +Retrieve information about all existing alerts. + +## SYNTAX + +### zOrg (Default) +``` +Get-ZAAlert [-zOrgIdentifier ] [-limitTo ] [] +``` + +### alertId +``` +Get-ZAAlert -alertIdentifier [] +``` + +## DESCRIPTION +Retrieve information about all existing alerts. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> Get-ZAAlert +``` + +Returns all alerts. + +### Example 2 +```powershell +PS C:\> Get-ZAAlert -limitTo 10 +``` + +Returns 10 alerts. + +### Example 3 +```powershell +PS C:\> Get-ZAAlert -zOrgIdentifier "1234-5678-9012" +``` + +Returns all alerts for the zOrg with Identifier "1234-5678-9012". + +### Example 4 +```powershell +PS C:\> Get-ZAAlert -zOrgIdentifier "1234-5678-9012" -limitTo 10 +``` + +Returns 10 alerts for the zOrg with Identifier "1234-5678-9012". + +### Example 3 +```powershell +PS C:\> Get-ZAAlert -alertId "1234-5678-9012" +``` + +Returns one alert with identifier "1234-5678-9012". + +## PARAMETERS + +### -alertIdentifier +The VPG Idnetifier + +```yaml +Type: String +Parameter Sets: alertId +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -limitTo +The maximum number of alerts to return. + +```yaml +Type: Int32 +Parameter Sets: zOrg +Aliases: + +Required: False +Position: Named +Default value: 0 +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -zOrgIdentifier +The ZORG identifier by which to filter the alert list. +If the ZORG identifier is omitted, a list of all the alerts is retrieved. + +```yaml +Type: String +Parameter Sets: zOrg +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +## NOTES + +## RELATED LINKS + +[Zerto Analytics REST API Endpoint for Alerts](https://docs.api.zerto.com/#/Monitoring/get_v2_monitoring_alerts) +[Zerto Analytics REST API Endpoint for Alerts by Identifier](https://docs.api.zerto.com/#/Monitoring/get_v2_monitoring_alerts__alertIdentifier_) diff --git a/docs/Get-ZADatastore.md b/docs/Get-ZADatastore.md new file mode 100644 index 0000000..eb9f7f2 --- /dev/null +++ b/docs/Get-ZADatastore.md @@ -0,0 +1,123 @@ +--- +external help file: ZertoApiWrapper-help.xml +Module Name: ZertoApiWrapper +online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZATask.md +schema: 2.0.0 +--- + +# Get-ZADatastore + +## SYNOPSIS + +Get a list of datastore/s, filtered by site. Enter a site identifier only to get the list of all datastores. Enter a site identifier and cluster identifier to get a list of datastores in the cluster. Enter a site identifier and datastore identifier to get specific datastore info. + +## SYNTAX + +### AllInfo (Default) +``` +Get-ZADatastore -siteIdentifier [] +``` + +### datastore +``` +Get-ZADatastore -siteIdentifier -datastoreIdentifier [] +``` + +### cluster +``` +Get-ZADatastore -siteIdentifier -clusterIdentifier [] +``` + +## DESCRIPTION + +Get a list of datastore/s, filtered by site. Enter a site identifier only to get the list of all datastores. Enter a site identifier and cluster identifier to get a list of datastores in the cluster. Enter a site identifier and datastore identifier to get specific datastore info. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> Get-ZADatastore -siteIdentifier "7890-1234-5678" +``` + +Returns all datastore clusters and datastores associated with site identifier "7890-1234-5678" + +### Example 2 +```powershell +PS C:\> Get-ZADatastore -siteIdentifier "7890-1234-5678" -clusterIdentifier "3456-7890-1234" +``` + +Returns datastore cluster information with identifier "3456-7890-1234" associated with site identifier "7890-1234-5678" + +### Example 3 +```powershell +PS C:\> Get-ZADatastore -siteIdentifier "7890-1234-5678" -datastoreIdentifier "5678-9012-3456" +``` + +Returns all datastore information with identifier "5678-9012-3456" associated with site identifier "7890-1234-5678" + +## PARAMETERS + +### -clusterIdentifier +The datastore cluster identifier. +Gets a list of datastores in the cluster. + +```yaml +Type: String +Parameter Sets: cluster +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -datastoreIdentifier +The datastore identifer. +Gets the datastore info. + +```yaml +Type: String +Parameter Sets: datastore +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -siteIdentifier +The site identifier. +The site identifier is mandatory. +Omit the datastore and datastore cluster identifiers to view site level storage information. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### None + +## OUTPUTS + +### System.Object +## NOTES + +## RELATED LINKS + +[Zerto Analytics REST API Endpoint for Datastores](https://docs.api.zerto.com/#/Monitoring/get_v2_monitoring_datastores) diff --git a/docs/Get-ZAEvent.md b/docs/Get-ZAEvent.md new file mode 100644 index 0000000..eb6844a --- /dev/null +++ b/docs/Get-ZAEvent.md @@ -0,0 +1,140 @@ +--- +external help file: ZertoApiWrapper-help.xml +Module Name: ZertoApiWrapper +online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZAEvent.md +schema: 2.0.0 +--- + +# Get-ZAEvent + +## SYNOPSIS + +Retrieve details of all existing events. + +## SYNTAX + +``` +Get-ZAEvent [[-zOrgIdentifier] ] [[-category] ] [[-limitTo] ] [[-startDate] ] + [[-endDate] ] [] +``` + +## DESCRIPTION + +Retrieve details of all existing events. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> Get-ZAEvent +``` + +Retrieve details of all existing events. + +### Example 2 +```powershell +PS C:\> Get-ZAEvent -zOrgIdentifier "1234-5678-9012" +``` + +Retrieve details of all existing events for zOrg with Identifier "1234-5678-9012" + +### Example 3 +```powershell +PS C:\> Get-ZAEvent -category events -startDate "2019-03-01" -endDate "2019-04-01" -limitTo 400 +``` + +Retrieve details of all events between March 1st and April 1st and limit results to 400. + +## PARAMETERS + +### -category +The event category (events/alertsHistory). +Default displays the list of all. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: 2 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -endDate +The latest timestamp of an event to return, in RFC 3339 standard ('1970-01-01T00:00:00Z'). +Default is the present time. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: 5 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -limitTo +The maximum number of events to return. + +```yaml +Type: Int32 +Parameter Sets: (All) +Aliases: + +Required: False +Position: 3 +Default value: 0 +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -startDate +The earliest timestamp of an event to return, in RFC 3339 standard ('1970-01-01T00:00:00Z'). +Default is one year ago. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: 4 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -zOrgIdentifier +The ZORG identifier by which to filter the user's events. +If the ZORG identifier is omitted, events is retrieved. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: 1 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +## NOTES + +## RELATED LINKS + +[Zerto Analytics REST API Endpoint for Events](https://docs.api.zerto.com/#/Monitoring/get_v2_monitoring_events) diff --git a/docs/Get-ZAJournalAverageHistory.md b/docs/Get-ZAJournalAverageHistory.md new file mode 100644 index 0000000..ee375b9 --- /dev/null +++ b/docs/Get-ZAJournalAverageHistory.md @@ -0,0 +1,123 @@ +--- +external help file: ZertoApiWrapper-help.xml +Module Name: ZertoApiWrapper +online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZAJournalAverageHistory.md +schema: 2.0.0 +--- + +# Get-ZAJournalAverageHistory + +## SYNOPSIS + +Retrieves the list of historical average journal history values for a specific VPG, filtered by start date, end date, and optional interval. The interval defines the journal history samples interval. + +## SYNTAX + +``` +Get-ZAJournalAverageHistory [-vpgIdentifier] [[-startDate] ] [[-endDate] ] + [[-interval] ] [] +``` + +## DESCRIPTION + +Retrieves the list of historical average journal history values for a specific VPG, filtered by start date, end date, and optional interval. The interval defines the journal history samples interval. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> Get-ZAJournalAverageHistory -vpgIdentifier "9876-5432-1098" +``` + +Returns Journal Average History information for VPG with identifier "9876-5432-1098" + +### Example 2 +```powershell +PS C:\> Get-ZAJournalAverageHistory -vpgIdentifier "9876-5432-1098" -startDate "2019-06-01" -endDate "2019-06-08" +``` + +Returns Journal Average History for VPG with identifier "9876-5432-1098" between the dates specified. + +### Example 3 +```powershell +PS C:\> Get-ZAJournalAverageHistory -vpgIdentifier "9876-5432-1098" -startDate "2019-06-01" -endDate "2019-06-08" -interval 7200 +``` + +Returns Journal Average History for VPG with identifier "9876-5432-1098" between the dates specified with a 2 hour interval. + +## PARAMETERS + +### -endDate +The end date of the report, in RFC 3339 standard ('1970-01-01T00:00:00Z'). +The default is the current time. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: 3 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -interval +The interval selected within the duration of the report. The interval can be per hour, for up to 15 days' time frame or per day, for between 15 to 30 days' time frame. Submit value in Seconds + +```yaml +Type: Int32 +Parameter Sets: (All) +Aliases: + +Required: False +Position: 4 +Default value: 0 +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -startDate +The starting date of the report, in RFC 3339 standard ('1970-01-01T00:00:00Z'). +If only the end date is added, the start date by default will be the end date minus 7 days. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: 2 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -vpgIdentifier +The identifier of the VPG. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: 1 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +## NOTES + +## RELATED LINKS + +[Zerto Analytics REST API Endpoint for Journal Average History](https://docs.api.zerto.com/#/Journal_Reports/get_v2_reports_journal_history_average) diff --git a/docs/Get-ZAJournalAverageSize.md b/docs/Get-ZAJournalAverageSize.md new file mode 100644 index 0000000..d7d4287 --- /dev/null +++ b/docs/Get-ZAJournalAverageSize.md @@ -0,0 +1,123 @@ +--- +external help file: ZertoApiWrapper-help.xml +Module Name: ZertoApiWrapper +online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZAJournalAverageSize.md +schema: 2.0.0 +--- + +# Get-ZAJournalAverageSize + +## SYNOPSIS + +Retrieves the list of historical average journal storage values for a specific VPG, filtered by start date, end date, and optional interval. The interval defines the journal storage samples interval. + +## SYNTAX + +``` +Get-ZAJournalAverageSize [-vpgIdentifier] [[-startDate] ] [[-endDate] ] + [[-interval] ] [] +``` + +## DESCRIPTION + +Retrieves the list of historical average journal storage values for a specific VPG, filtered by start date, end date, and optional interval. The interval defines the journal storage samples interval. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> Get-ZAJournalAverageSize -vpgIdentifier "9876-5432-1098" +``` + +Returns Journal Average Size information for VPG with identifier "9876-5432-1098" + +### Example 2 +```powershell +PS C:\> Get-ZAJournalAverageSize -vpgIdentifier "9876-5432-1098" -startDate "2019-06-01" -endDate "2019-06-08" +``` + +Returns Journal Average Size for VPG with identifier "9876-5432-1098" between the dates specified. + +### Example 3 +```powershell +PS C:\> Get-ZAJournalAverageSize -vpgIdentifier "9876-5432-1098" -startDate "2019-06-01" -endDate "2019-06-08" -interval 7200 +``` + +Returns Journal Average Size for VPG with identifier "9876-5432-1098" between the dates specified with a 2 hour interval. + +## PARAMETERS + +### -endDate +The end date of the report, in RFC 3339 standard ('1970-01-01T00:00:00Z'). +The default is the current time. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: 3 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -interval +The interval selected within the duration of the report. The interval can be per hour, for up to 15 days' time frame or per day, for between 15 to 30 days' time frame. Submit value in Seconds + +```yaml +Type: Int32 +Parameter Sets: (All) +Aliases: + +Required: False +Position: 4 +Default value: 0 +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -startDate +The starting date of the report, in RFC 3339 standard ('1970-01-01T00:00:00Z'). +If only the end date is added, the start date by default will be the end date minus 7 days. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: 2 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -vpgIdentifier +The identifier of the VPG. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: 1 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +## NOTES + +## RELATED LINKS + +[Zerto Analytics REST API Endpoint for Journal Average Size](https://docs.api.zerto.com/#/Journal_Reports/get_v2_reports_journal_size_average) diff --git a/docs/Get-ZAJournalBreach.md b/docs/Get-ZAJournalBreach.md new file mode 100644 index 0000000..fb8c6ed --- /dev/null +++ b/docs/Get-ZAJournalBreach.md @@ -0,0 +1,101 @@ +--- +external help file: ZertoApiWrapper-help.xml +Module Name: ZertoApiWrapper +online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZAJournalBreach.md +schema: 2.0.0 +--- + +# Get-ZAJournalBreach + +## SYNOPSIS + +Retrieves the journal history breaches over the selected timeframe. + +## SYNTAX + +``` +Get-ZAJournalBreach [-vpgIdentifier] [[-startDate] ] [[-endDate] ] + [] +``` + +## DESCRIPTION + +Retrieves the journal history breaches over the selected timeframe. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> Get-ZAJournalBreach -vpgIdentifier "9876-5432-1098" +``` + +Returns Journal Breach information for VPG with identifier "9876-5432-1098" + +### Example 2 +```powershell +PS C:\> Get-ZAJournalBreach -vpgIdentifier "9876-5432-1098" -startDate "2019-06-01" -endDate "2019-06-08" +``` + +Returns Journal Breach information for VPG with identifier "9876-5432-1098" between the dates specified. + +## PARAMETERS + +### -endDate +The end date of the report, in RFC 3339 standard ('1970-01-01T00:00:00Z'). +The default is the current time. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: 3 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -startDate +The starting date of the report, in RFC 3339 standard ('1970-01-01T00:00:00Z'). +If only the end date is added, the start date by default will be the end date minus 7 days. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: 2 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -vpgIdentifier +The identifier of the VPG. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: 1 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +## NOTES + +## RELATED LINKS + +[Zerto Analytics REST API Endpoint for Journal Breach](https://docs.api.zerto.com/#/Journal_Reports/get_v2_reports_journal_breach) diff --git a/docs/Get-ZAJournalHistoryStat.md b/docs/Get-ZAJournalHistoryStat.md new file mode 100644 index 0000000..679acaf --- /dev/null +++ b/docs/Get-ZAJournalHistoryStat.md @@ -0,0 +1,101 @@ +--- +external help file: ZertoApiWrapper-help.xml +Module Name: ZertoApiWrapper +online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZAJournalHistoryStat.md +schema: 2.0.0 +--- + +# Get-ZAJournalHistoryStat + +## SYNOPSIS + +Retrieves Journal history min, max and avg Statistics over the selected timeframe. + +## SYNTAX + +``` +Get-ZAJournalHistoryStat [-vpgIdentifier] [[-startDate] ] [[-endDate] ] + [] +``` + +## DESCRIPTION + +Retrieves Journal history min, max and avg Statistics over the selected timeframe. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> Get-ZAJournalHistoryStat -vpgIdentifier "9876-5432-1098" +``` + +Returns Journal History Stats for VPG with identifier "9876-5432-1098" + +### Example 2 +```powershell +PS C:\> Get-ZAJournalHistoryStat -vpgIdentifier "9876-5432-1098" -startDate "2019-06-01" -endDate "2019-06-08" +``` + +Returns Journal History Stats for VPG with identifier "9876-5432-1098" between the dates specified. + +## PARAMETERS + +### -endDate +The end date of the report, in RFC 3339 standard ('1970-01-01T00:00:00Z'). +The default is the current time. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: 3 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -startDate +The starting date of the report, in RFC 3339 standard ('1970-01-01T00:00:00Z'). +If only the end date is added, the start date by default will be the end date minus 7 days. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: 2 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -vpgIdentifier +The identifier of the VPG. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: 1 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +## NOTES + +## RELATED LINKS + +[Zerto Analytics REST API Endpoint for Journal History Stats](https://docs.api.zerto.com/#/Journal_Reports/get_v2_reports_stats_journal_history) diff --git a/docs/Get-ZAJournalSiteAverageHistory.md b/docs/Get-ZAJournalSiteAverageHistory.md new file mode 100644 index 0000000..38fc79f --- /dev/null +++ b/docs/Get-ZAJournalSiteAverageHistory.md @@ -0,0 +1,123 @@ +--- +external help file: ZertoApiWrapper-help.xml +Module Name: ZertoApiWrapper +online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZAJournalSiteAverageHistory.md +schema: 2.0.0 +--- + +# Get-ZAJournalSiteAverageHistory + +## SYNOPSIS + +Get list of samples of average Journal History values for all VPGs replicating to a specified recovery site, filtered by start date, end date, and optional interval. The interval defines the Journal History samples interval. + +## SYNTAX + +``` +Get-ZAJournalSiteAverageHistory [-recoverySiteIdentifier] [[-startDate] ] + [[-endDate] ] [[-interval] ] [] +``` + +## DESCRIPTION + +Get list of samples of average Journal History values for all VPGs replicating to a specified recovery site, filtered by start date, end date, and optional interval. The interval defines the Journal History samples interval. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> Get-ZAJournalSiteAverageHistory -recoverySiteIdentifier "9876-5432-1098" +``` + +Returns Journal Average History information for the recovery site with identifier "9876-5432-1098" + +### Example 2 +```powershell +PS C:\> Get-ZAJournalSiteAverageHistory -recoverySiteIdentifier "9876-5432-1098" -startDate "2019-06-01" -endDate "2019-06-08" +``` + +Returns Journal Average History information for the recovery site with identifier "9876-5432-1098" between the dates specified. + +### Example 3 +```powershell +PS C:\> Get-ZAJournalSiteAverageHistory -recoverySiteIdentifier "9876-5432-1098" -startDate "2019-06-01" -endDate "2019-06-08" -interval 7200 +``` + +Returns Journal Average History information for the recovery site with identifier "9876-5432-1098" between the dates specified with a 2 hour interval. + +## PARAMETERS + +### -endDate +The end date of the report, in RFC 3339 standard ('1970-01-01T00:00:00Z'). +The default is the current time. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: 3 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -interval +The interval selected within the duration of the report. The interval can be per hour, for up to 15 days' time frame or per day, for between 15 to 30 days' time frame. Submit value in Seconds + +```yaml +Type: Int32 +Parameter Sets: (All) +Aliases: + +Required: False +Position: 4 +Default value: 0 +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -recoverySiteIdentifier +The identifier of the recovery site. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: 1 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -startDate +The starting date of the report, in RFC 3339 standard ('1970-01-01T00:00:00Z'). +If only the end date is added, the start date by default will be the end date minus 7 days. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: 2 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +## NOTES + +## RELATED LINKS + +[Zerto Analytics REST API Endpoint for Journal Average Site History](https://docs.api.zerto.com/#/Journal_Reports/get_v2_reports_site_journal_history_average) diff --git a/docs/Get-ZAJournalSiteAverageSize.md b/docs/Get-ZAJournalSiteAverageSize.md new file mode 100644 index 0000000..65b78a6 --- /dev/null +++ b/docs/Get-ZAJournalSiteAverageSize.md @@ -0,0 +1,123 @@ +--- +external help file: ZertoApiWrapper-help.xml +Module Name: ZertoApiWrapper +online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZAJournalSiteAverageSize.md +schema: 2.0.0 +--- + +# Get-ZAJournalSiteAverageSize + +## SYNOPSIS + +Get list of samples of total Journal Size of all VPGs replicating to a specified recovery site, filtered by start date, end date, and optional interval. The interval defines the Journal Size samples interval. + +## SYNTAX + +``` +Get-ZAJournalSiteAverageSize [-recoverySiteIdentifier] [[-startDate] ] [[-endDate] ] + [[-interval] ] [] +``` + +## DESCRIPTION + +Get list of samples of total Journal Size of all VPGs replicating to a specified recovery site, filtered by start date, end date, and optional interval. The interval defines the Journal Size samples interval. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> Get-ZAJournalSiteAverageSize -recoverySiteIdentifier "9876-5432-1098" +``` + +Returns Journal Average Size information for the recovery site with identifier "9876-5432-1098" + +### Example 2 +```powershell +PS C:\> Get-ZAJournalSiteAverageSize -recoverySiteIdentifier "9876-5432-1098" -startDate "2019-06-01" -endDate "2019-06-08" +``` + +Returns Journal Average Size information for the recovery site with identifier "9876-5432-1098" between the dates specified. + +### Example 3 +```powershell +PS C:\> Get-ZAJournalSiteAverageSize -recoverySiteIdentifier "9876-5432-1098" -startDate "2019-06-01" -endDate "2019-06-08" -interval 7200 +``` + +Returns Journal Average Size information for the recovery site with identifier "9876-5432-1098" between the dates specified with a 2 hour interval. + +## PARAMETERS + +### -endDate +The end date of the report, in RFC 3339 standard ('1970-01-01T00:00:00Z'). +The default is the current time. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: 3 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -interval +The interval selected within the duration of the report. The interval can be per hour, for up to 15 days' time frame or per day, for between 15 to 30 days' time frame. Submit value in Seconds + +```yaml +Type: Int32 +Parameter Sets: (All) +Aliases: + +Required: False +Position: 4 +Default value: 0 +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -recoverySiteIdentifier +The identifier of the recovery Site. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: 1 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -startDate +The starting date of the report, in RFC 3339 standard ('1970-01-01T00:00:00Z'). +If only the end date is added, the start date by default will be the end date minus 7 days. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: 2 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +## NOTES + +## RELATED LINKS + +[Zerto Analytics REST API Endpoint for Journal Average Site Size](https://docs.api.zerto.com/#/Journal_Reports/get_v2_reports_site_journal_size_average) diff --git a/docs/Get-ZAJournalSiteHistoryStat.md b/docs/Get-ZAJournalSiteHistoryStat.md new file mode 100644 index 0000000..b2573fe --- /dev/null +++ b/docs/Get-ZAJournalSiteHistoryStat.md @@ -0,0 +1,123 @@ +--- +external help file: ZertoApiWrapper-help.xml +Module Name: ZertoApiWrapper +online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZAJournalSiteHistoryStat.md +schema: 2.0.0 +--- + +# Get-ZAJournalSiteHistoryStat + +## SYNOPSIS + +Get Max, Avg. and Min Journal History statistics for all VPGs replicating to a specified recovery site, filtered by start date, end date, and optional interval. The interval defines the journal history samples interval. + +## SYNTAX + +``` +Get-ZAJournalSiteHistoryStat [-recoverySiteIdentifier] [[-startDate] ] [[-endDate] ] + [[-interval] ] [] +``` + +## DESCRIPTION + +Get Max, Avg. and Min Journal History statistics for all VPGs replicating to a specified recovery site, filtered by start date, end date, and optional interval. The interval defines the journal history samples interval. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> Get-ZAJournalSiteHistoryStat -recoverySiteIdentifier "9876-5432-1098" +``` + +Returns Journal Average History information for the recovery site with identifier "9876-5432-1098" + +### Example 2 +```powershell +PS C:\> Get-ZAJournalSiteHistoryStat -recoverySiteIdentifier "9876-5432-1098" -startDate "2019-06-01" -endDate "2019-06-08" +``` + +Returns Journal Average History information for the recovery site with identifier "9876-5432-1098" between the dates specified. + +### Example 3 +```powershell +PS C:\> Get-ZAJournalSiteHistoryStat -recoverySiteIdentifier "9876-5432-1098" -startDate "2019-06-01" -endDate "2019-06-08" -interval 7200 +``` + +Returns Journal Average History information for the recovery site with identifier "9876-5432-1098" between the dates specified with a 2 hour interval. + +## PARAMETERS + +### -endDate +The end date of the report, in RFC 3339 standard ('1970-01-01T00:00:00Z'). +The default is the current time. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: 3 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -interval +The interval selected within the duration of the report. The interval can be per hour, for up to 15 days' time frame or per day, for between 15 to 30 days' time frame. Submit value in Seconds + +```yaml +Type: Int32 +Parameter Sets: (All) +Aliases: + +Required: False +Position: 4 +Default value: 0 +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -recoverySiteIdentifier +The identifier of the recovery site. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: 1 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -startDate +The starting date of the report, in RFC 3339 standard ('1970-01-01T00:00:00Z'). +If only the end date is added, the start date by default will be the end date minus 7 days. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: 2 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +## NOTES + +## RELATED LINKS + +[Zerto Analytics REST API Endpoint for Journal Site History Stats](https://docs.api.zerto.com/#/Journal_Reports/get_v2_reports_site_journal_history_stats) diff --git a/docs/Get-ZAJournalSiteHistorySummary.md b/docs/Get-ZAJournalSiteHistorySummary.md new file mode 100644 index 0000000..9f275d5 --- /dev/null +++ b/docs/Get-ZAJournalSiteHistorySummary.md @@ -0,0 +1,123 @@ +--- +external help file: ZertoApiWrapper-help.xml +Module Name: ZertoApiWrapper +online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZAJournalSiteHistorySummary.md +schema: 2.0.0 +--- + +# Get-ZAJournalSiteHistorySummary + +## SYNOPSIS + +Get a Journal History executive summary for all VPGs replicating to a specified recovery site. + +## SYNTAX + +``` +Get-ZAJournalSiteHistorySummary [-recoverySiteIdentifier] [[-startDate] ] + [[-endDate] ] [[-interval] ] [] +``` + +## DESCRIPTION + +Get a Journal History executive summary for all VPGs replicating to a specified recovery site. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> Get-ZAJournalSiteHistorySummary -recoverySiteIdentifier "9876-5432-1098" +``` + +Returns Journal History Executive Summary information for the recovery site with identifier "9876-5432-1098" + +### Example 2 +```powershell +PS C:\> Get-ZAJournalSiteHistorySummary -recoverySiteIdentifier "9876-5432-1098" -startDate "2019-06-01" -endDate "2019-06-08" +``` + +Returns Journal History Executive Summary information for the recovery site with identifier "9876-5432-1098" between the dates specified. + +### Example 3 +```powershell +PS C:\> Get-ZAJournalSiteHistorySummary -recoverySiteIdentifier "9876-5432-1098" -startDate "2019-06-01" -endDate "2019-06-08" -interval 7200 +``` + +Returns Journal History Executive Summary information for the recovery site with identifier "9876-5432-1098" between the dates specified with a 2 hour interval. + +## PARAMETERS + +### -endDate +The end date of the report, in RFC 3339 standard ('1970-01-01T00:00:00Z'). +The default is the current time. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: 3 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -interval +The interval selected within the duration of the report. The interval can be per hour, for up to 15 days' time frame or per day, for between 15 to 30 days' time frame. Submit value in Seconds + +```yaml +Type: Int32 +Parameter Sets: (All) +Aliases: + +Required: False +Position: 4 +Default value: 0 +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -recoverySiteIdentifier +The identifier of the recovery site. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: 1 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -startDate +The starting date of the report, in RFC 3339 standard ('1970-01-01T00:00:00Z'). +If only the end date is added, the start date by default will be the end date minus 7 days. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: 2 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +## NOTES + +## RELATED LINKS + +[Zerto Analytics REST API Endpoint for Journal Site History Summary](https://docs.api.zerto.com/#/Journal_Reports/get_v2_reports_site_journal_history_summary) diff --git a/docs/Get-ZAJournalSiteSizeStat.md b/docs/Get-ZAJournalSiteSizeStat.md new file mode 100644 index 0000000..4f3244c --- /dev/null +++ b/docs/Get-ZAJournalSiteSizeStat.md @@ -0,0 +1,123 @@ +--- +external help file: ZertoApiWrapper-help.xml +Module Name: ZertoApiWrapper +online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZAJournalSiteSizeStat.md +schema: 2.0.0 +--- + +# Get-ZAJournalSiteSizeStat + +## SYNOPSIS + +Get Max, Avg. and Min of total Journal Size statistics for all VPGs replicating to a specified recovery site, filtered by start date, end date, and optional interval. The interval defines the journal history samples interval. + +## SYNTAX + +``` +Get-ZAJournalSiteSizeStat [-recoverySiteIdentifier] [[-startDate] ] [[-endDate] ] + [[-interval] ] [] +``` + +## DESCRIPTION + +Get Max, Avg. and Min of total Journal Size statistics for all VPGs replicating to a specified recovery site, filtered by start date, end date, and optional interval. The interval defines the journal history samples interval. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> Get-ZAJournalSiteSizeStat -recoverySiteIdentifier "9876-5432-1098" +``` + +Returns Journal Size Statistics information for the recovery site with identifier "9876-5432-1098" + +### Example 2 +```powershell +PS C:\> Get-ZAJournalSiteSizeStat -recoverySiteIdentifier "9876-5432-1098" -startDate "2019-06-01" -endDate "2019-06-08" +``` + +Returns Journal Size Statistics information for the recovery site with identifier "9876-5432-1098" between the dates specified. + +### Example 3 +```powershell +PS C:\> Get-ZAJournalSiteSizeStat -recoverySiteIdentifier "9876-5432-1098" -startDate "2019-06-01" -endDate "2019-06-08" -interval 7200 +``` + +Returns Journal Size Statistics information for the recovery site with identifier "9876-5432-1098" between the dates specified with a 2 hour interval. + +## PARAMETERS + +### -endDate +The end date of the report, in RFC 3339 standard ('1970-01-01T00:00:00Z'). +The default is the current time. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: 3 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -interval +The interval selected within the duration of the report. The interval can be per hour, for up to 15 days' time frame or per day, for between 15 to 30 days' time frame. Submit value in Seconds + +```yaml +Type: Int32 +Parameter Sets: (All) +Aliases: + +Required: False +Position: 4 +Default value: 0 +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -recoverySiteIdentifier +The identifier of the recovery site. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: 1 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -startDate +The starting date of the report, in RFC 3339 standard ('1970-01-01T00:00:00Z'). +If only the end date is added, the start date by default will be the end date minus 7 days. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: 2 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +## NOTES + +## RELATED LINKS + +[Zerto Analytics REST API Endpoint for Journal Site size Stats](https://docs.api.zerto.com/#/Journal_Reports/get_v2_reports_site_journal_size_stats) diff --git a/docs/Get-ZAJournalStatusProportion.md b/docs/Get-ZAJournalStatusProportion.md new file mode 100644 index 0000000..479cf9a --- /dev/null +++ b/docs/Get-ZAJournalStatusProportion.md @@ -0,0 +1,101 @@ +--- +external help file: ZertoApiWrapper-help.xml +Module Name: ZertoApiWrapper +online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZAJournalStatusProportion.md +schema: 2.0.0 +--- + +# Get-ZAJournalStatusProportion + +## SYNOPSIS + +Retrieves journal history SLA status distribution over selected timeframe. + +## SYNTAX + +``` +Get-ZAJournalStatusProportion [-vpgIdentifier] [[-startDate] ] [[-endDate] ] + [] +``` + +## DESCRIPTION + +Retrieves journal history SLA status distribution over selected timeframe. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> Get-ZAJournalStatusProportion -vpgIdentifier "9876-5432-1098" +``` + +Returns Journal history SLA status distribution for VPG with identifier "9876-5432-1098" + +### Example 2 +```powershell +PS C:\> Get-ZAJournalStatusProportion -vpgIdentifier "9876-5432-1098" -startDate "2019-06-01" -endDate "2019-06-08" +``` + +Returns Journalhistory SLA status distribution for VPG with identifier "9876-5432-1098" between the dates specified. + +## PARAMETERS + +### -endDate +The end date of the report, in RFC 3339 standard ('1970-01-01T00:00:00Z'). +The default is the current time. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: 3 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -startDate +The starting date of the report, in RFC 3339 standard ('1970-01-01T00:00:00Z'). +If only the end date is added, the start date by default will be the end date minus 7 days. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: 2 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -vpgIdentifier +The identifier of the VPG. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: 1 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +## NOTES + +## RELATED LINKS + +[Zerto Analytics REST API Endpoint for Journal Statuses Proportions](https://docs.api.zerto.com/#/Journal_Reports/get_v2_reports_journal_statuses_proportions) diff --git a/docs/Get-ZAJournalStorageStat.md b/docs/Get-ZAJournalStorageStat.md new file mode 100644 index 0000000..5467598 --- /dev/null +++ b/docs/Get-ZAJournalStorageStat.md @@ -0,0 +1,101 @@ +--- +external help file: ZertoApiWrapper-help.xml +Module Name: ZertoApiWrapper +online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZAJournalStorageStat.md +schema: 2.0.0 +--- + +# Get-ZAJournalStorageStat + +## SYNOPSIS + +Retrieves Journal Storage minimum, maximum and average. Statistics over the selected timeframe. + +## SYNTAX + +``` +Get-ZAJournalStorageStat [-vpgIdentifier] [[-startDate] ] [[-endDate] ] + [] +``` + +## DESCRIPTION + +Retrieves Journal Storage minimum, maximum and average. Statistics over the selected timeframe. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> Get-ZAJournalStorageStat -vpgIdentifier "9876-5432-1098" +``` + +Returns Journal Storage Stats for VPG with identifier "9876-5432-1098" + +### Example 2 +```powershell +PS C:\> Get-ZAJournalStorageStat -vpgIdentifier "9876-5432-1098" -startDate "2019-06-01" -endDate "2019-06-08" +``` + +Returns Journal Storage Stats for VPG with identifier "9876-5432-1098" between the dates specified. + +## PARAMETERS + +### -endDate +The end date of the report, in RFC 3339 standard ('1970-01-01T00:00:00Z'). +The default is the current time. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: 3 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -startDate +The starting date of the report, in RFC 3339 standard ('1970-01-01T00:00:00Z'). +If only the end date is added, the start date by default will be the end date minus 7 days. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: 2 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -vpgIdentifier +The identifier of the VPG. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: 1 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +## NOTES + +## RELATED LINKS + +[Zerto Analytics REST API Endpoint for Journal Storage Stats](https://docs.api.zerto.com/#/Journal_Reports/get_v2_reports_stats_journal_storage) diff --git a/docs/Get-ZAJournalSummary.md b/docs/Get-ZAJournalSummary.md new file mode 100644 index 0000000..0a7df27 --- /dev/null +++ b/docs/Get-ZAJournalSummary.md @@ -0,0 +1,101 @@ +--- +external help file: ZertoApiWrapper-help.xml +Module Name: ZertoApiWrapper +online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZAJournalSummary.md +schema: 2.0.0 +--- + +# Get-ZAJournalSummary + +## SYNOPSIS + +Retrieves journal historical statistics for a given VPG. + +## SYNTAX + +``` +Get-ZAJournalSummary [-vpgIdentifier] [[-startDate] ] [[-endDate] ] + [] +``` + +## DESCRIPTION + +Retrieves journal historical statistics for a given VPG. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> Get-ZAJournalSummary -vpgIdentifier "9876-5432-1098" +``` + +Returns Journal Summary information for VPG with identifier "9876-5432-1098" + +### Example 2 +```powershell +PS C:\> Get-ZAJournalSummary -vpgIdentifier "9876-5432-1098" -startDate "2019-06-01" -endDate "2019-06-08" +``` + +Returns Journal Summary information for VPG with identifier "9876-5432-1098" between the dates specified. + +## PARAMETERS + +### -endDate +The end date of the report, in RFC 3339 standard ('1970-01-01T00:00:00Z'). +The default is the current time. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: 3 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -startDate +The starting date of the report, in RFC 3339 standard ('1970-01-01T00:00:00Z'). +If only the end date is added, the start date by default will be the end date minus 7 days. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: 2 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -vpgIdentifier +The identifier of the VPG. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: 1 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +## NOTES + +## RELATED LINKS + +[Zerto Analytics REST API Endpoint for Journal Summary](https://docs.api.zerto.com/#/Journal_Reports/get_v2_reports_journal_summary) diff --git a/docs/Get-ZALicense.md b/docs/Get-ZALicense.md new file mode 100644 index 0000000..5e8c16b --- /dev/null +++ b/docs/Get-ZALicense.md @@ -0,0 +1,45 @@ +--- +external help file: ZertoApiWrapper-help.xml +Module Name: ZertoApiWrapper +online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZALicense.md +schema: 2.0.0 +--- + +# Get-ZALicense + +## SYNOPSIS + +Retrieve a list of all licenses. + +## SYNTAX + +``` +Get-ZALicense [] +``` + +## DESCRIPTION +Retrieve a list of all licenses. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> Get-ZALicense +``` + +Returns all licenses and associated information + +## PARAMETERS + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +## NOTES + +## RELATED LINKS + +[Zerto Analytics REST API License End Point Documentation](https://docs.api.zerto.com/#/Licenses/get_v2_licenses) diff --git a/docs/Get-ZAMonitoring.md b/docs/Get-ZAMonitoring.md new file mode 100644 index 0000000..8e7b71c --- /dev/null +++ b/docs/Get-ZAMonitoring.md @@ -0,0 +1,69 @@ +--- +external help file: ZertoApiWrapper-help.xml +Module Name: ZertoApiWrapper +online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZAMonitoring.md +schema: 2.0.0 +--- + +# Get-ZAMonitoring + +## SYNOPSIS + +Retrieve statistics related to all the user's sites - belonging to a single account. + +## SYNTAX + +``` +Get-ZAMonitoring [[-zOrgIdentifier] ] [] +``` + +## DESCRIPTION + +Retrieve statistics related to all the user's sites - belonging to a single account. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> Get-ZAMonitoring +``` + +Retrieve statistics related to all the user's sites - belonging to a single account. + +### Example 1 +```powershell +PS C:\> Get-ZAMonitoring -zOrgIdentifier "1234-5678-9012" +``` + +Retrieve statistics related to the zOrgIdentifier provided + +## PARAMETERS + +### -zOrgIdentifier +The ZORG identifier by which to filter the user's statistics for a single account. +If the ZORG identifier is omitted, statistics related to all sites, for a single account, is retrieved. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: 1 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +## NOTES + +## RELATED LINKS + +[Zerto Analytics REST API Endpoint for Monitoring](https://docs.api.zerto.com/#/Monitoring/get_v2_monitoring_) diff --git a/docs/Get-ZANetworkSiteAverageIOPS.md b/docs/Get-ZANetworkSiteAverageIOPS.md new file mode 100644 index 0000000..c341554 --- /dev/null +++ b/docs/Get-ZANetworkSiteAverageIOPS.md @@ -0,0 +1,183 @@ +--- +external help file: ZertoApiWrapper-help.xml +Module Name: ZertoApiWrapper +online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZANetworkSiteAverageIOPS.md +schema: 2.0.0 +--- + +# Get-ZANetworkSiteAverageIOPS + +## SYNOPSIS + +Get average and maximum IOPS performance for sites, filtered by start date and end date, and optional intervals. + +## SYNTAX + +### ProtectedSite (Default) +``` +Get-ZANetworkSiteAverageIOPS -protectedSiteIdentifier [-recoverySiteIdentifier ] + [-startDate ] [-endDate ] [-zOrgIdentifier ] [-interval ] [] +``` + +### RecoverySite +``` +Get-ZANetworkSiteAverageIOPS [-protectedSiteIdentifier ] -recoverySiteIdentifier + [-startDate ] [-endDate ] [-zOrgIdentifier ] [-interval ] [] +``` + +## DESCRIPTION + +Get average and maximum IOPS performance for sites, filtered by start date and end date, and optional intervals. +The following options are available: + +* To view average and maximum IOPS performance of all outgoing traffic from a protected site to all its replicating sites, specify only the protected site identifier. +* To view average and maximum IOPS performance between two sites, specify both the protected site identifier and the recovery site identifier. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> Get-ZANetworkSiteAverageIOPS -protectedSiteIdentifier "7890-1234-5678" +``` + +Returns outgoing networks IOPS average from site with identifier "7890-1234-5678" + +### Example 2 +```powershell +PS C:\> Get-ZANetworkSiteAverageIOPS -protectedSiteIdentifier "7890-1234-5678" -recoverySiteIdentifier "9876-5432-1098" +``` + +Returns network IOPS average between sites with identifiers "7890-1234-5678" and "9876-5432-1098" + +## PARAMETERS + +### -endDate +End date in RFC 3339 standard ('1970-01-01T00:00:00Z'). +If the end date is omitted, the default end date is the current time. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -interval +The interval selected within the duration of the report. The interval can be per hour, for up to 15 days' time frame or per day, for between 15 to 30 days' time frame. Submit value in Seconds + +```yaml +Type: Int32 +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: 0 +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -protectedSiteIdentifier +Protected site identifier. +A site identification is required for at least one of the sites. + +```yaml +Type: String +Parameter Sets: ProtectedSite +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +```yaml +Type: String +Parameter Sets: RecoverySite +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -recoverySiteIdentifier +Recovery site identifier. +If the recovery site identifier is omitted, the API will show all outgoing traffic from the protected site to its replicating sites. + +```yaml +Type: String +Parameter Sets: ProtectedSite +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +```yaml +Type: String +Parameter Sets: RecoverySite +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -startDate +Start date in RFC 3339 standard ('1970-01-01T00:00:00Z'). +If the start date is omitted, the default start date is 7 days before the end date. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -zOrgIdentifier +The ZORG identifier by which to filter the executive summary. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +## NOTES + +## RELATED LINKS + +[Zerto Analytics REST API Endpoint for Network Site Average IOPS](https://docs.api.zerto.com/#/Network_Reports/get_v2_reports_sites_network_iops_average) diff --git a/docs/Get-ZANetworkSiteAveragePerformance.md b/docs/Get-ZANetworkSiteAveragePerformance.md new file mode 100644 index 0000000..effcce6 --- /dev/null +++ b/docs/Get-ZANetworkSiteAveragePerformance.md @@ -0,0 +1,183 @@ +--- +external help file: ZertoApiWrapper-help.xml +Module Name: ZertoApiWrapper +online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZANetworkSiteAveragePerformance.md +schema: 2.0.0 +--- + +# Get-ZANetworkSiteAveragePerformance + +## SYNOPSIS + +Get list of samples of average and maximum network performance metrics (throughput and WAN traffic) for sites, filtered by start date and end date, and optional intervals. + +## SYNTAX + +### ProtectedSite (Default) +``` +Get-ZANetworkSiteAveragePerformance -protectedSiteIdentifier [-recoverySiteIdentifier ] + [-startDate ] [-endDate ] [-zOrgIdentifier ] [-interval ] [] +``` + +### RecoverySite +``` +Get-ZANetworkSiteAveragePerformance [-protectedSiteIdentifier ] -recoverySiteIdentifier + [-startDate ] [-endDate ] [-zOrgIdentifier ] [-interval ] [] +``` + +## DESCRIPTION + +Get list of samples of average and maximum network performance metrics (throughput and WAN traffic) for sites, filtered by start date and end date, and optional intervals. +The following options are available: + +* To view average and maximum network performance of throughput vs. WAN traffic of all outgoing traffic from a protected site to all its replicating sites, specify only the protected site identifier. +* To view average and maximum network performance of throughput and WAN traffic between two sites, specify both the protected site identifier and the recovery site identifier. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> Get-ZANetworkSiteAveragePerformance -protectedSiteIdentifier "7890-1234-5678" +``` + +Returns outgoing networks performance average from site with identifier "7890-1234-5678" + +### Example 2 +```powershell +PS C:\> Get-ZANetworkSiteAveragePerformance -protectedSiteIdentifier "7890-1234-5678" -recoverySiteIdentifier "9876-5432-1098" +``` + +Returns network performance average between sites with identifiers "7890-1234-5678" and "9876-5432-1098" + +## PARAMETERS + +### -endDate +End date in RFC 3339 standard ('1970-01-01T00:00:00Z'). +If the end date is omitted, the default end date is the current time. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -interval +The interval selected within the duration of the report. The interval can be per hour, for up to 15 days' time frame or per day, for between 15 to 30 days' time frame. Submit value in Seconds + +```yaml +Type: Int32 +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: 0 +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -protectedSiteIdentifier +Protected site identifier. +A site identification is required for at least one of the sites. + +```yaml +Type: String +Parameter Sets: ProtectedSite +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +```yaml +Type: String +Parameter Sets: RecoverySite +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -recoverySiteIdentifier +Recovery site identifier. +If the recovery site identifier is omitted, the API will show all outgoing traffic from the protected site to its replicating sites. + +```yaml +Type: String +Parameter Sets: ProtectedSite +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +```yaml +Type: String +Parameter Sets: RecoverySite +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -startDate +Start date in RFC 3339 standard ('1970-01-01T00:00:00Z'). +If the start date is omitted, the default start date is 7 days before the end date. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -zOrgIdentifier +The ZORG identifier by which to filter the executive summary. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +## NOTES + +## RELATED LINKS + +[Zerto Analytics REST API Endpoint for Network Site Average Performance](https://docs.api.zerto.com/#/Network_Reports/get_v2_reports_sites_network_performance_average) diff --git a/docs/Get-ZANetworkSiteStat.md b/docs/Get-ZANetworkSiteStat.md new file mode 100644 index 0000000..ba37894 --- /dev/null +++ b/docs/Get-ZANetworkSiteStat.md @@ -0,0 +1,167 @@ +--- +external help file: ZertoApiWrapper-help.xml +Module Name: ZertoApiWrapper +online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZAMonitoring.md +schema: 2.0.0 +--- + +# Get-ZANetworkSiteStat + +## SYNOPSIS + +Get Max, Avg. and Min network statistics for Throughput, Wan and IOPS traffic for sites, filtered by start date and end date. + +## SYNTAX + +### ProtectedSite (Default) +``` +Get-ZANetworkSiteStat -protectedSiteIdentifier [-recoverySiteIdentifier ] + [-startDate ] [-endDate ] [-zOrgIdentifier ] [] +``` + +### RecoverySite +``` +Get-ZANetworkSiteStat [-protectedSiteIdentifier ] -recoverySiteIdentifier + [-startDate ] [-endDate ] [-zOrgIdentifier ] [] +``` + +## DESCRIPTION + +Get Max, Avg. and Min network statistics for Throughput, Wan and IOPS traffic for sites, filtered by start date and end date. The following options are available: + +* To view network stats of all outgoing traffic from a protected site to all its replicating sites, specify only the protected site identifier. +* To view network stats between two sites, specify both the protected site identifier and the recovery site identifier. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> Get-ZANetworkSiteStat -protectedSiteIdentifier "7890-1234-5678" +``` + +Returns all outgoing networks stats from site with identifier "7890-1234-5678" + +### Example 2 +```powershell +PS C:\> Get-ZANetworkSiteStat -protectedSiteIdentifier "7890-1234-5678" -recoverySiteIdentifier "9876-5432-1098" +``` + +Returns all networks stats between sites with identifiers "7890-1234-5678" and "9876-5432-1098" + +## PARAMETERS + +### -endDate +End date in RFC 3339 standard ('1970-01-01T00:00:00Z'). +If the end date is omitted, the default end date is the current time. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -protectedSiteIdentifier +Protected site identifier. +A site identification is required for at least one of the sites. + +```yaml +Type: String +Parameter Sets: ProtectedSite +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +```yaml +Type: String +Parameter Sets: RecoverySite +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -recoverySiteIdentifier +Recovery site identifier. +If the recovery site identifier is omitted, the API will show all outgoing traffic from the protected site to its replicating sites. + +```yaml +Type: String +Parameter Sets: ProtectedSite +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +```yaml +Type: String +Parameter Sets: RecoverySite +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -startDate +Start date in RFC 3339 standard ('1970-01-01T00:00:00Z'). +If the start date is omitted, the default start date is 7 days before the end date. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -zOrgIdentifier +The ZORG identifier by which to filter the executive summary. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +## NOTES + +## RELATED LINKS + +[Zerto Analytics REST API Endpoint for Network Site Summary](https://docs.api.zerto.com/#/Network_Reports/get_v2_reports_sites_network_stats) diff --git a/docs/Get-ZANetworkSiteSummary.md b/docs/Get-ZANetworkSiteSummary.md new file mode 100644 index 0000000..6840ac0 --- /dev/null +++ b/docs/Get-ZANetworkSiteSummary.md @@ -0,0 +1,167 @@ +--- +external help file: ZertoApiWrapper-help.xml +Module Name: ZertoApiWrapper +online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZANetworkSiteSummary.md +schema: 2.0.0 +--- + +# Get-ZANetworkSiteSummary + +## SYNOPSIS + +Get a network executive summary for sites, filtered by start date and end date. + +## SYNTAX + +### ProtectedSite (Default) +``` +Get-ZANetworkSiteSummary -protectedSiteIdentifier [-recoverySiteIdentifier ] + [-startDate ] [-endDate ] [-zOrgIdentifier ] [] +``` + +### RecoverySite +``` +Get-ZANetworkSiteSummary [-protectedSiteIdentifier ] -recoverySiteIdentifier + [-startDate ] [-endDate ] [-zOrgIdentifier ] [] +``` + +## DESCRIPTION + +Get a network executive summary for sites, filtered by start date and end date.The following options are available: + +* To view the network executive summary of all outgoing traffic from a protected site to all its replicating sites, specify only the protected site identifier. +* To view the network executive summary between two sites, specify both the protected site identifier and the recovery site identifier. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> Get-ZANetworkSiteSummary -protectedSiteIdentifier "7890-1234-5678" +``` + +Returns outgoing networks summary from site with identifier "7890-1234-5678" + +### Example 2 +```powershell +PS C:\> Get-ZANetworkSiteSummary -protectedSiteIdentifier "7890-1234-5678" -recoverySiteIdentifier "9876-5432-1098" +``` + +Returns network summary between sites with identifiers "7890-1234-5678" and "9876-5432-1098" + +## PARAMETERS + +### -endDate +End date in RFC 3339 standard ('1970-01-01T00:00:00Z'). +If the end date is omitted, the default end date is the current time. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -protectedSiteIdentifier +Protected site identifier. +A site identification is required for at least one of the sites. + +```yaml +Type: String +Parameter Sets: ProtectedSite +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +```yaml +Type: String +Parameter Sets: RecoverySite +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -recoverySiteIdentifier +Recovery site identifier. +If the recovery site identifier is omitted, the API will show all outgoing traffic from the protected site to its replicating sites. + +```yaml +Type: String +Parameter Sets: ProtectedSite +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +```yaml +Type: String +Parameter Sets: RecoverySite +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -startDate +Start date in RFC 3339 standard ('1970-01-01T00:00:00Z'). +If the start date is omitted, the default start date is 7 days before the end date. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -zOrgIdentifier +The ZORG identifier by which to filter the executive summary. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +## NOTES + +## RELATED LINKS + +[Zerto Analytics REST API Endpoint for Network Site Summary](https://docs.api.zerto.com/#/Network_Reports/get_v2_reports_sites_network_summary) diff --git a/docs/Get-ZANetworkVpgAverageIOPS.md b/docs/Get-ZANetworkVpgAverageIOPS.md new file mode 100644 index 0000000..ad707f9 --- /dev/null +++ b/docs/Get-ZANetworkVpgAverageIOPS.md @@ -0,0 +1,109 @@ +--- +external help file: ZertoApiWrapper-help.xml +Module Name: ZertoApiWrapper +online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZANetworkVpgAverageIOPS.md +schema: 2.0.0 +--- + +# Get-ZANetworkVpgAverageIOPS + +## SYNOPSIS + +Get average and maximum IOPS performance for a specific VPG, filtered by start date and end date, and optional intervals. + +## SYNTAX + +``` +Get-ZANetworkVpgAverageIOPS [-vpgIdentifier] [[-startDate] ] [[-endDate] ] + [[-interval] ] [] +``` + +## DESCRIPTION + +Get average and maximum IOPS performance for a specific VPG, filtered by start date and end date, and optional intervals. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> Get-ZANetworkVpgAverageIOPS -vpgIdentifier "3456-7890-1234" -interval 3600 +``` + +Get Network VPG Average IOPS for VPG with Identifier "3456-7890-1234" for the last 7 days at an interval of 1 hour. + +## PARAMETERS + +### -endDate +End date in RFC 3339 standard ('1970-01-01T00:00:00Z'). +If the end date is omitted, the default end date is the current time. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: 3 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -interval +The interval selected within the duration of the report. The interval can be per minute - for up to 6 hours, per hour - for 6 hours to 15 days, or per day - for 15 days up to 30 days. If an interval is not specified, the default is 60 seconds. Submit value in Seconds. + +```yaml +Type: Int32 +Parameter Sets: (All) +Aliases: + +Required: False +Position: 4 +Default value: 0 +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -startDate +Start date in RFC 3339 standard ('1970-01-01T00:00:00Z'). +If the start date is omitted, the default start date is 7 days before the end date. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: 2 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -vpgIdentifier +The VPG identifier. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: 1 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +## NOTES + +## RELATED LINKS + +[Zerto Analytics REST API Endpoint for Network VPG Average IOPS](https://docs.api.zerto.com/#/Network_Reports/get_v2_reports_vpg_network_iops_average) diff --git a/docs/Get-ZANetworkVpgAveragePerformance.md b/docs/Get-ZANetworkVpgAveragePerformance.md new file mode 100644 index 0000000..8c66050 --- /dev/null +++ b/docs/Get-ZANetworkVpgAveragePerformance.md @@ -0,0 +1,109 @@ +--- +external help file: ZertoApiWrapper-help.xml +Module Name: ZertoApiWrapper +online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZANetworkVpgAveragePerformance.md +schema: 2.0.0 +--- + +# Get-ZANetworkVpgAveragePerformance + +## SYNOPSIS + +Get average and maximum network performance of throughput vs. WAN traffic for a specific VPG filtered by start date and end date, and optional intervals. + +## SYNTAX + +``` +Get-ZANetworkVpgAveragePerformance [-vpgIdentifier] [[-startDate] ] [[-endDate] ] + [[-interval] ] [] +``` + +## DESCRIPTION + +Get average and maximum network performance of throughput vs. WAN traffic for a specific VPG filtered by start date and end date, and optional intervals + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> Get-ZANetworkVpgAveragePerformance -vpgIdentifier "3456-7890-1234" -interval 3600 +``` + +Get Network VPG Average Performance for VPG with Identifier "3456-7890-1234" for the last 7 days at an interval of 1 hour. + +## PARAMETERS + +### -endDate +End date in RFC 3339 standard ('1970-01-01T00:00:00Z'). +If the end date is omitted, the default end date is the current time. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: 3 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -interval +The interval selected within the duration of the report. The interval can be per minute - for up to 6 hours, per hour - for 6 hours to 15 days, or per day - for 15 days up to 30 days. If an interval is not specified, the default is 60 seconds. Submit value in Seconds. + +```yaml +Type: Int32 +Parameter Sets: (All) +Aliases: + +Required: False +Position: 4 +Default value: 0 +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -startDate +Start date in RFC 3339 standard ('1970-01-01T00:00:00Z'). +If the start date is omitted, the default start date is 7 days before the end date. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: 2 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -vpgIdentifier +The VPG identifier. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: 1 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +## NOTES + +## RELATED LINKS + +[Zerto Analytics REST API Endpoint for Network VPG Average Performance](https://docs.api.zerto.com/#/Network_Reports/get_v2_reports_vpg_network_performance_average) diff --git a/docs/Get-ZANetworkVpgStat.md b/docs/Get-ZANetworkVpgStat.md new file mode 100644 index 0000000..2820450 --- /dev/null +++ b/docs/Get-ZANetworkVpgStat.md @@ -0,0 +1,94 @@ +--- +external help file: ZertoApiWrapper-help.xml +Module Name: ZertoApiWrapper +online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZANetworkVpgStat.md +schema: 2.0.0 +--- + +# Get-ZANetworkVpgStat + +## SYNOPSIS + +Get Max, Avg. and Min network statistics for Throughput, Wan and IOPS traffic for a given VPG, filtered by start date and end date. + +## SYNTAX + +``` +Get-ZANetworkVpgStat [-vpgIdentifier] [[-startDate] ] [[-endDate] ] + [] +``` + +## DESCRIPTION + +Get Max, Avg. and Min network statistics for Throughput, Wan and IOPS traffic for a given VPG, filtered by start date and end date. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> Get-ZANetworkVpgStat -vpgIdentifier "3456-7890-1234" +``` + +Get Network VPG Stats for VPG with Identifier "3456-7890-1234" for the last 7 days. + +## PARAMETERS + +### -endDate +End date in RFC 3339 standard ('1970-01-01T00:00:00Z'). +If the end date is omitted, the default end date is the current time. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: 3 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -startDate +Start date in RFC 3339 standard ('1970-01-01T00:00:00Z'). +If the start date is omitted, the default start date is 7 days before the end date. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: 2 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -vpgIdentifier +The VPG identifier. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: 1 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +## NOTES + +## RELATED LINKS + +[Zerto Analytics REST API Endpoint for Network VPG Summary](https://docs.api.zerto.com/#/Network_Reports/get_v2_reports_vpg_network_summary) diff --git a/docs/Get-ZANetworkVpgSummary.md b/docs/Get-ZANetworkVpgSummary.md new file mode 100644 index 0000000..54eef27 --- /dev/null +++ b/docs/Get-ZANetworkVpgSummary.md @@ -0,0 +1,94 @@ +--- +external help file: ZertoApiWrapper-help.xml +Module Name: ZertoApiWrapper +online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZANetworkVpgSummary.md +schema: 2.0.0 +--- + +# Get-ZANetworkVpgSummary + +## SYNOPSIS + +Get a network executive summary for a given VPG, filtered by start date and end date. + +## SYNTAX + +``` +Get-ZANetworkVpgSummary [-vpgIdentifier] [[-startDate] ] [[-endDate] ] + [] +``` + +## DESCRIPTION + +Get a network executive summary for a given VPG, filtered by start date and end date. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> Get-ZANetworkVpgSummary -vpgIdentifier "3456-7890-1234" +``` + +Get Network VPG Summary for VPG with Identifier "3456-7890-1234" for the last 7 days. + +## PARAMETERS + +### -endDate +End date in RFC 3339 standard ('1970-01-01T00:00:00Z'). +If the end date is omitted, the default end date is the current time. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: 3 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -startDate +Start date in RFC 3339 standard ('1970-01-01T00:00:00Z'). +If the start date is omitted, the default start date is 7 days before the end date. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: 2 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -vpgIdentifier +The VPG identifier. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: 1 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +## NOTES + +## RELATED LINKS + +[Zerto Analytics REST API Endpoint for Network VPG Summary](https://docs.api.zerto.com/#/Network_Reports/get_v2_reports_vpg_network_summary) diff --git a/docs/Get-ZAPlannerJournalSizeReport.md b/docs/Get-ZAPlannerJournalSizeReport.md new file mode 100644 index 0000000..8d69627 --- /dev/null +++ b/docs/Get-ZAPlannerJournalSizeReport.md @@ -0,0 +1,163 @@ +--- +external help file: ZertoApiWrapper-help.xml +Module Name: ZertoApiWrapper +online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZAPlannerJournalSizeReport.md +schema: 2.0.0 +--- + +# Get-ZAPlannerJournalSizeReport + +## SYNOPSIS +Create a report request to retrieve the Journal Size for a specific VMs list, and timeframe. + +## SYNTAX + +``` +Get-ZAPlannerJournalSizeReport [-siteIdentifier] [-recoveryType] [-vmIdentifier] + [[-desiredJournalHistory] ] [[-startDate] ] [[-endDate] ] [] +``` + +## DESCRIPTION +Create a report request to retrieve the Journal Size for a specific VMs list, and timeframe. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> Get-ZAPlannerJournalSizeReport -siteIdentifier '1234567890-01923141' -recoveryType VMware -vmIdentifier 'vmIdentifier1', 'vmIdentifier2' +``` + +Gets a Journal report for VMs with identifiers 'vmIdentifier1' and 'vmIdentifier2' at source siteIdentifier '1234567890-01923141' where the target recovery location is VMware. The report will cover a Journal History of 24 hours. This will use all data contained in Zerto Analytics to create the Journal report. + +### Example 2 +```powershell +PS C:\> Get-ZAPlannerJournalSizeReport -siteIdentifier '1234567890-01923141' -recoveryType VMware -vmIdentifier 'vmIdentifier1', 'vmIdentifier2' -desiredJournalHistory 96 +``` + +Gets a Journal report for VMs with identifiers 'vmIdentifier1' and 'vmIdentifier2' at source siteIdentifier '1234567890-01923141' where the target recovery location is VMware. The report will cover a Journal History of 96 hours (4 days). This will use all data contained in Zerto Analytics to create the Journal report. + +### Example 3 +```powershell +PS C:\> Get-ZAPlannerJournalSizeReport -siteIdentifier '1234567890-01923141' -recoveryType VMware -vmIdentifier 'vmIdentifier1', 'vmIdentifier2' -desiredJournalHistory 96 -startDate '2020-01-01' +``` + +Gets a Journal report for VMs with identifiers 'vmIdentifier1' and 'vmIdentifier2' at source siteIdentifier '1234567890-01923141' where the target recovery location is VMware. The report will cover a Journal History of 96 hours (4 days). This will use all data starting from Jan 1st to today contained in Zerto Analytics to create the Journal report. + +### Example 4 +```powershell +PS C:\> Get-ZAPlannerJournalSizeReport -siteIdentifier '1234567890-01923141' -recoveryType VMware -vmIdentifier 'vmIdentifier1', 'vmIdentifier2' -desiredJournalHistory 96 -startDate '2020-01-01' -endDate '2020-01-30' +``` + +Gets a Journal report for VMs with identifiers 'vmIdentifier1' and 'vmIdentifier2' at source siteIdentifier '1234567890-01923141' where the target recovery location is VMware. The report will cover a Journal History of 96 hours (4 days). This will use all data starting from Jan 1st to Jan 30th contained in Zerto Analytics to create the Journal report. + +## PARAMETERS + +### -desiredJournalHistory +The desired journal history in hours. +The default is 24 hours. +Limited to a 1 hour up to 720 hours, or the equivalent of 30 days + +```yaml +Type: Int32 +Parameter Sets: (All) +Aliases: + +Required: False +Position: 4 +Default value: 24 +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -endDate +The latest timestamp of an event to return, in RFC 3339 standard. +('1970-01-01T00:00:00Z'). +The default is the current time. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: 6 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -recoveryType +Type of target recovery site. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: 2 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -siteIdentifier +The site identifier(s) for which to return detailed information. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: 1 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -startDate +The earliest timestamp of an event to return, in RFC 3339 standard. +('1970-01-01T00:00:00Z'). +The default is one year ago. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: 5 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -vmIdentifier +Identifiers of the VMs you want to recover at the target recovery site. + +```yaml +Type: String[] +Parameter Sets: (All) +Aliases: + +Required: True +Position: 3 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +## NOTES + +## RELATED LINKS + +[Zerto Planner Journal Size Report - Post](https://docs.api.zerto.com/#/Planner/post_v2_planner_reports_stats_journal_size) +[Zerto Planner Journal Size Report - Get](https://docs.api.zerto.com/#/Planner/get_v2_planner_reports_stats_journal_size) diff --git a/docs/Get-ZAPlannerNetworkPerformanceReport.md b/docs/Get-ZAPlannerNetworkPerformanceReport.md new file mode 100644 index 0000000..e69dbbd --- /dev/null +++ b/docs/Get-ZAPlannerNetworkPerformanceReport.md @@ -0,0 +1,158 @@ +--- +external help file: ZertoApiWrapper-help.xml +Module Name: ZertoApiWrapper +online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZAPlannerNetworkPerformanceReport.md +schema: 2.0.0 +--- + +# Get-ZAPlannerNetworkPerformanceReport + +## SYNOPSIS +Create a report request to retrieve the Network Performance for a specific VMs list, and timeframe. + +## SYNTAX + +``` +Get-ZAPlannerNetworkPerformanceReport [-siteIdentifier] [-recoveryType] + [-vmIdentifier] [[-interval] ] [[-startDate] ] [[-endDate] ] + [] +``` + +## DESCRIPTION +Create a report request to retrieve the Network Performance for a specific VMs list, and timeframe. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> Get-ZAPlannerNetworkPerformanceReport -siteIdentifier '1234567890-01923141' -recoveryType VMware -vmIdentifier 'vmIdentifier1', 'vmIdentifier2' +``` + +Gets a Network Performance report for VMs with identifiers 'vmIdentifier1' and 'vmIdentifier2' at source siteIdentifier '1234567890-01923141' where the target recovery location is VMware. This will use all data contained in Zerto Analytics to create the Journal report. + +### Example 2 +```powershell +PS C:\> Get-ZAPlannerNetworkPerformanceReport -siteIdentifier '1234567890-01923141' -recoveryType VMware -vmIdentifier 'vmIdentifier1', 'vmIdentifier2' -startDate '2020-01-01' -interval 86400 +``` + +Gets a Network Performance report for VMs with identifiers 'vmIdentifier1' and 'vmIdentifier2' at source siteIdentifier '1234567890-01923141' where the target recovery location is VMware. This will use data contained in Zerto Analytics starting Jan 1st, 2020 ending on the day the report is run to create the Journal report. Sample reporting interval will be 86400 seconds (1 day). + +### Example 3 +```powershell +PS C:\> Get-ZAPlannerNetworkPerformanceReport -siteIdentifier '1234567890-01923141' -recoveryType VMware -vmIdentifier 'vmIdentifier1', 'vmIdentifier2' -startDate '2020-01-01' -endDate '2020-01-30' -interval 86400 +``` + +Gets a Network Performance report for VMs with identifiers 'vmIdentifier1' and 'vmIdentifier2' at source siteIdentifier '1234567890-01923141' where the target recovery location is VMware. This will use data contained in Zerto Analytics starting Jan 1st, 2020 ending on Jan 30th, 2020 to create the Journal report. Sample reporting interval will be 86400 seconds (1 day). + +## PARAMETERS + +### -endDate +The latest timestamp of an event to return, in RFC 3339 standard. +('1970-01-01T00:00:00Z'). +The default is the current time. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: 6 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -interval +The desired sample interval in seconds. +The default is 3600 seconds (1 Hour). +Limited to a 60 second to 86,400 second (24 Hour) interval + +```yaml +Type: Int32 +Parameter Sets: (All) +Aliases: + +Required: False +Position: 4 +Default value: 3600 +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -recoveryType +Type of target recovery site. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: 2 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -siteIdentifier +The site identifier(s) for which to return detailed information. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: 1 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -startDate +The earliest timestamp of an event to return, in RFC 3339 standard. +('1970-01-01T00:00:00Z'). +The default is one year ago. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: 5 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -vmIdentifier +Identifiers of the VMs you want to recover at the target recovery site. + +```yaml +Type: String[] +Parameter Sets: (All) +Aliases: + +Required: True +Position: 3 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +## NOTES + +## RELATED LINKS + +[Zerto Analytics Planner Network-Performance API Endpoint - POST](https://docs.api.zerto.com/#/Planner/post_v2_planner_reports_network_performance) +[Zerto Analytics Planner Network-Performance API Endpoint - GET](https://docs.api.zerto.com/#/Planner/get_v2_planner_reports_network_performance) + diff --git a/docs/Get-ZAPlannerSite.md b/docs/Get-ZAPlannerSite.md new file mode 100644 index 0000000..f977330 --- /dev/null +++ b/docs/Get-ZAPlannerSite.md @@ -0,0 +1,67 @@ +--- +external help file: ZertoApiWrapper-help.xml +Module Name: ZertoApiWrapper +online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZAPlannerSite.md +schema: 2.0.0 +--- + +# Get-ZAPlannerSite + +## SYNOPSIS +Retrieve all active Planner sites for a specific account - includes ID, Name and Type or retrieves datacenter, host, and VMs for a specific site. + +## SYNTAX + +``` +Get-ZAPlannerSite [[-siteIdentifier] ] [] +``` + +## DESCRIPTION +Retrieve all active Planner sites for a specific account - includes ID, Name and Type or retrieves datacenter, host, and VMs for a specific site. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> Get-ZAPlannerSite +``` + +Retrieve all active Planner sites for a specific account + +### Example 2 +```powershell +PS C:\> Get-ZAPlannerSite -siteIdentifier '0123-45676-09876' +``` + +Retrieves datacenter, host, and VMs for site with Identifier '0123-45676-09876'. + +## PARAMETERS + +### -siteIdentifier +The site identifier(s) for which to return detailed information. + +```yaml +Type: String[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: 1 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +## NOTES + +## RELATED LINKS + +[Zerto Analytics Sites Planner Endpoint](https://docs.api.zerto.com/#/Planner/get_v2_planner_sites) +[Zerto Analytics Single Site Planner Endpoint](https://docs.api.zerto.com/#/Planner/get_v2_planner_sites__siteIdentifier_) diff --git a/docs/Get-ZAPlannerStatsReport.md b/docs/Get-ZAPlannerStatsReport.md new file mode 100644 index 0000000..bdecfbb --- /dev/null +++ b/docs/Get-ZAPlannerStatsReport.md @@ -0,0 +1,149 @@ +--- +external help file: ZertoApiWrapper-help.xml +Module Name: ZertoApiWrapper +online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZAPlannerStatsReport.md +schema: 2.0.0 +--- + +# Get-ZAPlannerStatsReport + +## SYNOPSIS +Create a report request for the selected VMs for a specific timeframe, retrieving all stats data for ZCAs, WAN, Journal size and array of VMs avg IOPs, avg throughput and journal size. + +## SYNTAX + +``` +Get-ZAPlannerStatsReport [-siteIdentifier] [-recoveryType] [-vmIdentifier] + [[-desiredJournalHistory] ] [[-startDate] ] [[-endDate] ] [] +``` + +## DESCRIPTION +Create a report request for the selected VMs for a specific timeframe, retrieving all stats data for ZCAs, WAN, Journal size and array of VMs avg IOPs, avg throughput and journal size. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> Get-ZAPlannerStatsReport -siteIdentifier '0123-45676-09876' -recoveryType vcenter -vmIdentifier 'vmIdentifier01', 'vmIdentifier02' +``` + +Will get a stats report for the two VMs listed recovering to a vCenter site with a 24 hour journal + +### Example 2 +```powershell +PS C:\> Get-ZAPlannerStatsReport -siteIdentifier '0123-45676-09876' -recoveryType Azure -vmIdentifier 'vmIdentifier01', 'vmIdentifier02' -desiredJournalHistory 72 +``` + +Will get a stats report for the two VMs listed recovering to an Azure site with a 72 hour journal + +## PARAMETERS + +### -desiredJournalHistory +The desired journal history in hours. +The default is 24 hours. +Limited to a 1 hour up to 720 hours, or the equivalent of 30 days + +```yaml +Type: Int32 +Parameter Sets: (All) +Aliases: + +Required: False +Position: 4 +Default value: 24 +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -endDate +The latest timestamp of an event to return, in RFC 3339 standard. +('1970-01-01T00:00:00Z'). +The default is the current time. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: 6 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -recoveryType +Type of target recovery site. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: 2 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -siteIdentifier +The site identifier(s) for which to return detailed information. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: 1 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -startDate +The earliest timestamp of an event to return, in RFC 3339 standard. +('1970-01-01T00:00:00Z'). +The default is one year ago. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: 5 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -vmIdentifier +Identifiers of the VMs you want to recover at the target recovery site. + +```yaml +Type: String[] +Parameter Sets: (All) +Aliases: + +Required: True +Position: 3 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +## NOTES + +## RELATED LINKS + +[Zerto Analytics Planner Stats API Endpoint - POST](https://docs.api.zerto.com/#/Planner/post_v2_planner_reports_stats) +[Zerto Analytics Planner Stats API Endpoint - GET](https://docs.api.zerto.com/#/Planner/get_v2_planner_reports_stats) diff --git a/docs/Get-ZAPlannerWanReport.md b/docs/Get-ZAPlannerWanReport.md new file mode 100644 index 0000000..88e0f4c --- /dev/null +++ b/docs/Get-ZAPlannerWanReport.md @@ -0,0 +1,125 @@ +--- +external help file: ZertoApiWrapper-help.xml +Module Name: ZertoApiWrapper +online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZAPlannerWanReport.md +schema: 2.0.0 +--- + +# Get-ZAPlannerWanReport + +## SYNOPSIS +Create a report request to retrieve WAN for a specific VMs list, and timeframe. + +## SYNTAX + +``` +Get-ZAPlannerWanReport [-siteIdentifier] [-recoveryType] [-vmIdentifier] + [[-startDate] ] [[-endDate] ] [] +``` + +## DESCRIPTION +Create a report request to retrieve WAN for a specific VMs list, and timeframe. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> Get-ZAPlannerWanReport -siteIdentifier '12345-0987654-254364' -recoveryType vcenter -vmIdentifier '1234-98789-0987', '1234-98789-1252' +``` + +Get a WAN requirements report for VMs at the protected site. + +## PARAMETERS + +### -endDate +The latest timestamp of an event to return, in RFC 3339 standard. +('1970-01-01T00:00:00Z'). +The default is the current time. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: 5 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -recoveryType +Type of target recovery site. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: 2 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -siteIdentifier +The site identifier(s) for which to return detailed information. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: 1 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -startDate +The earliest timestamp of an event to return, in RFC 3339 standard. +('1970-01-01T00:00:00Z'). +The default is one year ago. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: 4 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -vmIdentifier +Identifiers of the VMs you want to recover at the target recovery site. + +```yaml +Type: String[] +Parameter Sets: (All) +Aliases: + +Required: True +Position: 3 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +## NOTES + +## RELATED LINKS + +[Zerto Analytics Planner Wan Stats API Endpoint - POST](https://docs.api.zerto.com/#/Planner/post_v2_planner_reports_stats_wan) +[Zerto Analytics Planner Wan Stats API Endpoint - GET](https://docs.api.zerto.com/#/Planner/get_v2_planner_reports_stats_wan) diff --git a/docs/Get-ZAPlannerZcasReport.md b/docs/Get-ZAPlannerZcasReport.md new file mode 100644 index 0000000..bdde4dc --- /dev/null +++ b/docs/Get-ZAPlannerZcasReport.md @@ -0,0 +1,125 @@ +--- +external help file: ZertoApiWrapper-help.xml +Module Name: ZertoApiWrapper +online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZAPlannerZcasReport.md +schema: 2.0.0 +--- + +# Get-ZAPlannerZcasReport + +## SYNOPSIS +Create a report request to retrieve ZCAs for a specific VMs list, and timeframe. + +## SYNTAX + +``` +Get-ZAPlannerZcasReport [-siteIdentifier] [-recoveryType] [-vmIdentifier] + [[-startDate] ] [[-endDate] ] [] +``` + +## DESCRIPTION +Create a report request to retrieve ZCAs for a specific VMs list, and timeframe. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> Get-ZAPlannerZcasReport -siteIdentifier '12345-0987654-254364' -recoveryType azure -vmIdentifier '1234-98789-0987', '1234-98789-1252' +``` + +Get a report for the number of required ZCA's in Azure to protect the supplied VMs. + +## PARAMETERS + +### -endDate +The latest timestamp of an event to return, in RFC 3339 standard. +('1970-01-01T00:00:00Z'). +The default is the current time. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: 5 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -recoveryType +Type of target recovery site. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: 2 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -siteIdentifier +The site identifier(s) for which to return detailed information. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: 1 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -startDate +The earliest timestamp of an event to return, in RFC 3339 standard. +('1970-01-01T00:00:00Z'). +The default is one year ago. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: 4 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -vmIdentifier +Identifiers of the VMs you want to recover at the target recovery site. + +```yaml +Type: String[] +Parameter Sets: (All) +Aliases: + +Required: True +Position: 3 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +## NOTES + +## RELATED LINKS + +[Zerto Analytics Planner ZCA Stats API Endpoint - POST](https://docs.api.zerto.com/#/Planner/post_v2_planner_reports_stats_zcas) +[Zerto Analytics Planner ZCA Stats API Endpoint - GET](https://docs.api.zerto.com/#/Planner/get_v2_planner_reports_stats_zcas) diff --git a/docs/Get-ZAProtectedVm.md b/docs/Get-ZAProtectedVm.md new file mode 100644 index 0000000..c6726d2 --- /dev/null +++ b/docs/Get-ZAProtectedVm.md @@ -0,0 +1,120 @@ +--- +external help file: ZertoApiWrapper-help.xml +Module Name: ZertoApiWrapper +online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZAProtectedVm.md +schema: 2.0.0 +--- + +# Get-ZAProtectedVm + +## SYNOPSIS +Gets information about currently protected Virtual Machines in all sites. If desired a subset of VMs can be returned by providing VM Identifiers for each virtual machine. + +## SYNTAX + +### AllVMs (Default) +``` +Get-ZAProtectedVm [-AllVms] [] +``` + +### IndividualVMs +``` +Get-ZAProtectedVm -VMIdentifier [-Volumes] [] +``` + +## DESCRIPTION +Gets information about currently protected Virtual Machines in all sites. If desired a subset of VMs can be returned by providing VM Identifiers for each virtual machine. Finally, when gathering information for individual virtual machines, the `-Volumes` parameter can be specified to return volume information for the protected VM. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> Get-ZAProtectedVm +``` + +Returns all protected virtual machines across all sites. + +### Example 2 +```powershell +PS C:\> Get-ZAProtectedVm -AllVMs +``` + +Returns all protected virtual machines across all sites. + +### Example 3 +```powershell +PS C:\> Get-ZAProtectedVm -VMIdentifier '09914-12345-12341235', '81238-12532-12355332' +``` + +Returns information for only the two specified virtual machines + +### Example 4 +```powershell +PS C:\> Get-ZAProtectedVm -VMIdentifier '09914-12345-12341235', '81238-12532-12355332' -Volumes +``` + +Returns volume information for the two specified virtual machines + +## PARAMETERS + +### -AllVms +Use this switch when you want a list of all protected VMs. +Please be warned this list can be quite large. + +```yaml +Type: SwitchParameter +Parameter Sets: AllVMs +Aliases: + +Required: False +Position: Named +Default value: False +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -VMIdentifier +A list of VM identifiers to query + +```yaml +Type: String[] +Parameter Sets: IndividualVMs +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Volumes +Specify this switch when you would like protected vms' volume information returned + +```yaml +Type: SwitchParameter +Parameter Sets: IndividualVMs +Aliases: + +Required: False +Position: Named +Default value: False +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +## NOTES + +## RELATED LINKS + +[Zerto Analytics Protected VMs API Endpoint - AllVMs](https://docs.api.zerto.com/#/Monitoring/get_v2_monitoring_protected_vms) +[Zerto Analytics Protected VMs API Endpoint - List of VMs](https://docs.api.zerto.com/#/Monitoring/get_v2_monitoring_protected_vms__vmIdentifier_) +[Zerto Analytics Protected VMs API Endpoint - Volumes of VMs](https://docs.api.zerto.com/#/Monitoring/get_v2_monitoring_protected_vms__vmIdentifier__volumes) + diff --git a/docs/Get-ZAProtectedVmReport.md b/docs/Get-ZAProtectedVmReport.md new file mode 100644 index 0000000..45fae12 --- /dev/null +++ b/docs/Get-ZAProtectedVmReport.md @@ -0,0 +1,60 @@ +--- +external help file: ZertoApiWrapper-help.xml +Module Name: ZertoApiWrapper +online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZAProtectedVmReport.md +schema: 2.0.0 +--- + +# Get-ZAProtectedVmReport + +## SYNOPSIS +Creates a report of the requested protected virtual machines' volumes. + +## SYNTAX + +``` +Get-ZAProtectedVmReport -VMIdentifier [] +``` + +## DESCRIPTION +Creates a report of the requested protected virtual machines' volumes. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> Get-ZAProtectedVmReport -VMIdentifier '09914-12345-12341235', '81238-12532-12355332' +``` + +Generates a protected vm report for the virtual machines with the specified VMIdentifiers. + +## PARAMETERS + +### -VMIdentifier +A list of VM identifiers to include in the report. + +```yaml +Type: String[] +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +## NOTES + +## RELATED LINKS + +[Zerto Analytics Protected VMs Report API Endpoint - POST](https://docs.api.zerto.com/#/Monitoring/post_v2_monitoring_protected_vms) +[Zerto Analytics Protected VMs Report API Endpoint - GET](https://docs.api.zerto.com/#/Monitoring/get_v2_monitoring_protected_vms_reportId__reportId_) diff --git a/docs/Get-ZARPOAccountAverage.md b/docs/Get-ZARPOAccountAverage.md new file mode 100644 index 0000000..3d8803f --- /dev/null +++ b/docs/Get-ZARPOAccountAverage.md @@ -0,0 +1,109 @@ +--- +external help file: ZertoApiWrapper-help.xml +Module Name: ZertoApiWrapper +online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/Master/docs/Get-ZARPOAccountAverage.md +schema: 2.0.0 +--- + +# Get-ZARPOAccountAverage + +## SYNOPSIS + +Get average RPO for all VPGs in a single account, filtered by last 30 days. + +## SYNTAX + +``` +Get-ZARPOAccountAverage [[-zOrgIdentifier] ] [[-startDate] ] [[-endDate] ] + [] +``` + +## DESCRIPTION + +Get average RPO for all VPGs in a single account, filtered by last 30 days. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> Get-ZARPOAccountAverage +``` + +Get average RPO for all VPGs in a single account. + +### Example 2 +```powershell +PS C:\> Get-ZARPOAccountAverage -zOrgIdentifier "1234-5678-9012" +``` + +Get average RPO for all VPGs in zOrg with identifier "1234-5678-9012". + +### Example 3 +```powershell +PS C:\> Get-ZARPOAccountAverage -startDate "2019-06-01T00:00:00Z" -endDate "2019-06-02T00:00:00Z" +``` + +Get average RPO for all VPGs in a single account for June 6th, 2019 + +## PARAMETERS + +### -endDate +The end date of the report, in RFC 3339 standard ('1970-01-01T00:00:00Z'). +The default is the current time. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: 3 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -startDate +The starting date of the report, in RFC 3339 standard ('1970-01-01T00:00:00Z'). +If only the end date is added, the start date by default will be the end date minus 7 days. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: 2 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -zOrgIdentifier +The ZORG identifier by which to filter the user's average RPO for a single account. +If the ZORG identifier is omitted, statistics related to all sites, for a single account, is retrieved. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: 1 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +## NOTES + +## RELATED LINKS + +[Zerto Analytics REST API Endpoint for Account RPO Average](https://docs.api.zerto.com/#/RPO_Reports/get_v2_reports_account_rpo_average) diff --git a/docs/Get-ZARPOAverage.md b/docs/Get-ZARPOAverage.md new file mode 100644 index 0000000..4264ab8 --- /dev/null +++ b/docs/Get-ZARPOAverage.md @@ -0,0 +1,118 @@ +--- +external help file: ZertoApiWrapper-help.xml +Module Name: ZertoApiWrapper +online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/Master/docs/Get-ZARPOAverage.md +schema: 2.0.0 +--- + +# Get-ZARPOAverage + +## SYNOPSIS + +Retrieves list of average RPO values for a specific VPG, filtered by start date, end date, and optional interval. The interval defines the RPO samples interval. by default a 1 minutes interval. + +## SYNTAX + +``` +Get-ZARPOAverage [-vpgIdentifier] [[-startDate] ] [[-endDate] ] [[-interval] ] + [] +``` + +## DESCRIPTION + +Retrieves list of average RPO values for a specific VPG, filtered by start date, end date, and optional interval. The interval defines the RPO samples interval. by default a 1 minutes interval. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> Get-ZARPOAverage -vpgIdentifier "5678-9012-3456" +``` + +Returns RPO Average over the past 7 days for VPG with Identifier "5678-9012-3456" + +### Example 2 +```powershell +PS C:\> Get-ZARPOAverage -vpgIdentifier "5678-9012-3456" -startDate "2019-06-01T12:00:00Z" -endDate "2019-06-01T14:00:00Z" -interval 60 +``` + +Returns RPO Average in one minute intervals for the time period between June 1st, 2019 at Noon to June 1st, 2019 at 14:00 for VPG with Identifier "5678-9012-3456" + +## PARAMETERS + +### -endDate +The end date of the report, in RFC 3339 standard ('1970-01-01T00:00:00Z'). +The default is the current time. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: 3 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -interval +The interval selected within the duration of the report. +The interval can be 1-minute data granularity for up to 6 hours' time frame, 1-hour data granularity for 6 hours to 15 days' time frame or 1-day data granularity for 15 days up to 30 days' time frame. +Value should be submitted in Seconds + +```yaml +Type: Int32 +Parameter Sets: (All) +Aliases: + +Required: False +Position: 4 +Default value: 0 +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -startDate +The starting date of the report, in RFC 3339 standard ('1970-01-01T00:00:00Z'). +If only the end date is added, the start date by default will be the end date minus 7 days. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: 2 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -vpgIdentifier +The identifier of the VPG. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: 1 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +## NOTES + +## RELATED LINKS + +[Zerto Analytics REST API Endpoint for RPO Average](https://docs.api.zerto.com/#/RPO_Reports/get_v2_reports_rpo_average) diff --git a/docs/Get-ZARPOBreach.md b/docs/Get-ZARPOBreach.md new file mode 100644 index 0000000..5c60b30 --- /dev/null +++ b/docs/Get-ZARPOBreach.md @@ -0,0 +1,107 @@ +--- +external help file: ZertoApiWrapper-help.xml +Module Name: ZertoApiWrapper +online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZARPOBreach.md +schema: 2.0.0 +--- + +# Get-ZARPOBreach + +## SYNOPSIS + +Retrieves RPO breaches over the selected timeframe. + +## SYNTAX + +``` +Get-ZARPOBreach [-vpgIdentifier] [[-startDate] ] [[-endDate] ] [] +``` + +## DESCRIPTION + +Retrieves RPO breaches over the selected timeframe. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> Get-ZARPOBreach -vpgIdentifier "3456-7890-1234" +``` + +Gets the RPO Breaches for the VPG with identifier "3456-7890-1234" for the past 7 days. + +### Example 2 +```powershell +PS C:\> Get-ZARPOBreach -vpgIdentifier "3456-7890-1234" -startDate "2019-01-01T00:00:00" +``` + +Gets the RPO Breaches for the VPG with identifier "3456-7890-1234" starting January 1st, 2019 till the date this command is run. + +### Example 3 +```powershell +PS C:\> Get-ZARPOBreach -vpgIdentifier "3456-7890-1234" -startDate "2019-01-01T00:00:00" -endDate "2019-02-01T00:00:00" +``` + +Gets the RPO Breaches for the VPG with identifier "3456-7890-1234" for the Month of January. + +## PARAMETERS + +### -endDate +The end date of the report, in RFC 3339 standard ('1970-01-01T00:00:00Z'). +The default is the current time. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: 3 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -startDate +The starting date of the report, in RFC 3339 standard ('1970-01-01T00:00:00Z'). +If only the end date is added, the start date by default will be the end date minus 7 days. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: 2 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -vpgIdentifier +The identifier of the VPG. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: 1 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +## NOTES + +## RELATED LINKS + +[Zerto Analytics REST API Endpoint for RPO Breach](https://docs.api.zerto.com/#/RPO_Reports/get_v2_reports_rpo_breach) diff --git a/docs/Get-ZARPOStat.md b/docs/Get-ZARPOStat.md new file mode 100644 index 0000000..e44a232 --- /dev/null +++ b/docs/Get-ZARPOStat.md @@ -0,0 +1,107 @@ +--- +external help file: ZertoApiWrapper-help.xml +Module Name: ZertoApiWrapper +online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZARPOStat.md +schema: 2.0.0 +--- + +# Get-ZARPOStat + +## SYNOPSIS + +Retrieves Rpo min, max and avg. Stats. + +## SYNTAX + +``` +Get-ZARPOStat [-vpgIdentifier] [[-startDate] ] [[-endDate] ] [] +``` + +## DESCRIPTION + +Retrieves Rpo min, max and avg. Stats. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> Get-ZARPOStat -vpgIdentifier "3456-7890-1234" +``` + +Gets the RPO Stats for the VPG with identifier "3456-7890-1234" for the past 7 days. + +### Example 2 +```powershell +PS C:\> Get-ZARPOStat -vpgIdentifier "3456-7890-1234" -startDate "2019-01-01T00:00:00" +``` + +Gets the RPO Stats for the VPG with identifier "3456-7890-1234" starting January 1st, 2019 till the date this command is run. + +### Example 3 +```powershell +PS C:\> Get-ZARPOStat -vpgIdentifier "3456-7890-1234" -startDate "2019-01-01T00:00:00" -endDate "2019-02-01T00:00:00" +``` + +Gets the RPO Stats for the VPG with identifier "3456-7890-1234" for the Month of January. + +## PARAMETERS + +### -endDate +The end date of the report, in RFC 3339 standard ('1970-01-01T00:00:00Z'). +The default is the current time. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: 3 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -startDate +The starting date of the report, in RFC 3339 standard ('1970-01-01T00:00:00Z'). +If only the end date is added, the start date by default will be the end date minus 7 days. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: 2 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -vpgIdentifier +The identifier of the VPG. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: 1 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +## NOTES + +## RELATED LINKS + +[Zerto Analytics REST API Endpoint for RPO Stats](https://docs.api.zerto.com/#/RPO_Reports/get_v2_reports_stats_rpo) diff --git a/docs/Get-ZARPOStatusProportion.md b/docs/Get-ZARPOStatusProportion.md new file mode 100644 index 0000000..be274cf --- /dev/null +++ b/docs/Get-ZARPOStatusProportion.md @@ -0,0 +1,108 @@ +--- +external help file: ZertoApiWrapper-help.xml +Module Name: ZertoApiWrapper +online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZARPOStatusProportion.md +schema: 2.0.0 +--- + +# Get-ZARPOStatusProportion + +## SYNOPSIS + +Retrieves RPO SLA status distribution over the selected timeframe. + +## SYNTAX + +``` +Get-ZARPOStatusProportion [-vpgIdentifier] [[-startDate] ] [[-endDate] ] + [] +``` + +## DESCRIPTION + +Retrieves RPO SLA status distribution over the selected timeframe. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> Get-ZARPOStatusProportion -vpgIdentifier "3456-7890-1234" +``` + +Gets the RPO Breaches for the VPG with identifier "3456-7890-1234" for the past 7 days. + +### Example 2 +```powershell +PS C:\> Get-ZARPOStatusProportion -vpgIdentifier "3456-7890-1234" -startDate "2019-01-01T00:00:00" +``` + +Gets the RPO Breaches for the VPG with identifier "3456-7890-1234" starting January 1st, 2019 till the date this command is run. + +### Example 3 +```powershell +PS C:\> Get-ZARPOStatusProportion -vpgIdentifier "3456-7890-1234" -startDate "2019-01-01T00:00:00" -endDate "2019-02-01T00:00:00" +``` + +Gets the RPO Breaches for the VPG with identifier "3456-7890-1234" for the Month of January. + +## PARAMETERS + +### -endDate +The end date of the report, in RFC 3339 standard ('1970-01-01T00:00:00Z'). +The default is the current time. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: 3 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -startDate +The starting date of the report, in RFC 3339 standard ('1970-01-01T00:00:00Z'). +If only the end date is added, the start date by default will be the end date minus 7 days. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: 2 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -vpgIdentifier +The identifier of the VPG. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: 1 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +## NOTES + +## RELATED LINKS + +[Zerto Analytics REST API Endpoint for RPO Statuses Proportions](https://docs.api.zerto.com/#/RPO_Reports/get_v2_reports_rpo_statuses_proportions) diff --git a/docs/Get-ZARPOSummary.md b/docs/Get-ZARPOSummary.md new file mode 100644 index 0000000..40756ee --- /dev/null +++ b/docs/Get-ZARPOSummary.md @@ -0,0 +1,107 @@ +--- +external help file: ZertoApiWrapper-help.xml +Module Name: ZertoApiWrapper +online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZAMonitoring.md +schema: 2.0.0 +--- + +# Get-ZARPOSummary + +## SYNOPSIS + +Retrieves RPO historical statistics for a given VPG. + +## SYNTAX + +``` +Get-ZARPOSummary [-vpgIdentifier] [[-startDate] ] [[-endDate] ] [] +``` + +## DESCRIPTION + +Retrieves RPO historical statistics for a given VPG. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> Get-ZARPOSummary -vpgIdentifier "3456-7890-1234" +``` + +Gets the RPO Summary for the VPG with identifier "3456-7890-1234" for the past 7 days. + +### Example 2 +```powershell +PS C:\> Get-ZARPOSummary -vpgIdentifier "3456-7890-1234" -startDate "2019-01-01T00:00:00" +``` + +Gets the RPO Summary for the VPG with identifier "3456-7890-1234" starting January 1st, 2019 till the date this command is run. + +### Example 3 +```powershell +PS C:\> Get-ZARPOSummary -vpgIdentifier "3456-7890-1234" -startDate "2019-01-01T00:00:00" -endDate "2019-02-01T00:00:00" +``` + +Gets the RPO Summary for the VPG with identifier "3456-7890-1234" for the Month of January. + +## PARAMETERS + +### -endDate +The end date of the report, in RFC 3339 standard ('1970-01-01T00:00:00Z'). +The default is the current time. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: 3 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -startDate +The starting date of the report, in RFC 3339 standard ('1970-01-01T00:00:00Z'). +If only the end date is added, the start date by default will be the end date minus 7 days. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: 2 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -vpgIdentifier +The identifier of the VPG. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: 1 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +## NOTES + +## RELATED LINKS + +[Zerto Analytics REST API Endpoint for RPO Summary](https://docs.api.zerto.com/#/RPO_Reports/get_v2_reports_rpo_summary) diff --git a/docs/Get-ZASite.md b/docs/Get-ZASite.md new file mode 100644 index 0000000..ccc6c4b --- /dev/null +++ b/docs/Get-ZASite.md @@ -0,0 +1,69 @@ +--- +external help file: ZertoApiWrapper-help.xml +Module Name: ZertoApiWrapper +online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZASite.md +schema: 2.0.0 +--- + +# Get-ZASite + +## SYNOPSIS + +Retrieve a list of all sites. + +## SYNTAX + +``` +Get-ZASite [[-zOrgIdentifier] ] [] +``` + +## DESCRIPTION + +Retrieve a list of all sites. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> Get-ZASite +``` + +Retrieve a list of all sites. + +### Example 2 +```powershell +PS C:\> Get-ZASite -zOrgIdentifier "1234-5678-9012" +``` + +Retrieve a list of all sites managed under zOrgIdentifier "1234-5678-9012". + +## PARAMETERS + +### -zOrgIdentifier +The ZORG identifier by which to filter site list. +If the ZORG identifier is omitted, a list of all sites is retrieved. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: 1 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +## NOTES + +## RELATED LINKS + +[Zerto Analytics REST API Endpoint for Sites](https://docs.api.zerto.com/#/Monitoring/get_v2_monitoring_sites) diff --git a/docs/Get-ZASitePair.md b/docs/Get-ZASitePair.md new file mode 100644 index 0000000..be1f53f --- /dev/null +++ b/docs/Get-ZASitePair.md @@ -0,0 +1,104 @@ +--- +external help file: ZertoApiWrapper-help.xml +Module Name: ZertoApiWrapper +online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZASitePair.md +schema: 2.0.0 +--- + +# Get-ZASitePair + +## SYNOPSIS + +Get all the sites, protected and recovery, filtered by start date and end date. + +## SYNTAX + +``` +Get-ZASitePair [[-zOrgIdentifier] ] [[-startDate] ] [[-endDate] ] [] +``` + +## DESCRIPTION + +Get all the sites, protected and recovery, filtered by start date and end date. +* When startDate is omitted, the default startDate is 7 days before the endDate. +* When endDate is ommited, the default endDate is the current date. +* When both startDate and endDate are omitted, the default date range is the last 7 days. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> Get-ZASitePair +``` + +Returns all site pairings. + +### Example 1 +```powershell +PS C:\> Get-ZASitePair -zOrgIdentifier "9876-5432-1098" +``` + +Returns all site pairings belonging to zOrg with Identifier "9876-5432-1098". + +## PARAMETERS + +### -endDate +End date in RFC 3339 standard ('1970-01-01T00:00:00Z'). +If the end date is omitted, the default endDate is the current date. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: 3 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -startDate +Start date in RFC 3339 standard ('1970-01-01T00:00:00Z'). +If the start date is omitted, the default start date is 7 days before the end date. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: 2 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -zOrgIdentifier +The ZORG identifier by which to filter the site list. +If the ZORG identifier is omitted, a list of all sites is retrieved. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: 1 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +## NOTES + +## RELATED LINKS + +[Zerto Analytics REST API Endpoint for Site Pairs](https://docs.api.zerto.com/#/Network_Reports/get_v2_reports_sites_list) diff --git a/docs/Get-ZASiteTopology.md b/docs/Get-ZASiteTopology.md new file mode 100644 index 0000000..93cc3de --- /dev/null +++ b/docs/Get-ZASiteTopology.md @@ -0,0 +1,70 @@ +--- +external help file: ZertoApiWrapper-help.xml +Module Name: ZertoApiWrapper +online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZASiteTopology.md +schema: 2.0.0 +--- + +# Get-ZASiteTopology + +## SYNOPSIS + +Retrieves a collection of Sites topology information structures for all the available user's sites, including disabled and non-transmitting due to lack of a transmitter (older ZVR versions). + +## SYNTAX + +``` +Get-ZASiteTopology [[-zOrgIdentifier] ] [] +``` + +## DESCRIPTION + +Retrieves a collection of Sites topology information structures for all the available user's sites, including disabled and non-transmitting due to lack of a transmitter (older ZVR versions). | The following note should be taken into consideration: +The information might not be complete, since there are sites that do not transmit (disabled), yet this API concludes their presence and VPG count from the VPGs they share with transmitting sites. Such a disabled site might have relations with other disabled sites, which this API does not reveal. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> Get-ZASiteTopology +``` + +Retrieves a collection of Sites topology information structures for all the available user's sites. + +### Example 2 +```powershell +PS C:\> Get-ZASiteTopology -zOrgIdentifier "1234-5678-9012" +``` + +Retrieves a collection of Sites topology information structures for all the available user's sites within zOrgIdentifier "1234-5678-9012". + +## PARAMETERS + +### -zOrgIdentifier +The ZORG identifier by which to filter sites topology list. +If the ZORG identifier is omitted, information related to all sites topology is retrieved. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: 1 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +## NOTES + +## RELATED LINKS + +[Zerto Analytics REST API Endpoint for Site Topology](https://docs.api.zerto.com/#/Monitoring/get_v2_monitoring_sites_format_topology) diff --git a/docs/Get-ZATask.md b/docs/Get-ZATask.md new file mode 100644 index 0000000..e0bdbe7 --- /dev/null +++ b/docs/Get-ZATask.md @@ -0,0 +1,112 @@ +--- +external help file: ZertoApiWrapper-help.xml +Module Name: ZertoApiWrapper +online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZATask.md +schema: 2.0.0 +--- + +# Get-ZATask + +## SYNOPSIS + +Retrieve details of all existing tasks. + +## SYNTAX + +### zOrg (Default) +``` +Get-ZATask [-zOrgIdentifier ] [-limitTo ] [] +``` + +### taskId +``` +Get-ZATask -taskIdentifier [] +``` + +## DESCRIPTION + +Retrieve details of all existing tasks. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> Get-ZATask +``` + +Retrieve details of all existing tasks. + +### Example 2 +```powershell +PS C:\> Get-ZATask -zOrgIdentifier "1234-5678-9012" +``` + +Retrieve details of all existing tasks for zOrg with Identifier "1234-5678-9012". + +### Example 1 +```powershell +PS C:\> Get-ZATask -taskIdentifier "9012-3456-7890" +``` + +Retrieve details of a specific task with identifier "9012-3456-7890". + +## PARAMETERS + +### -limitTo +The maximum number of tasks to return. + +```yaml +Type: Int32 +Parameter Sets: zOrg +Aliases: + +Required: False +Position: Named +Default value: 0 +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -taskIdentifier +The task Idnetifier + +```yaml +Type: String +Parameter Sets: taskId +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -zOrgIdentifier +The ZORG identifier by which to filter the task list. +If the ZORG identifier is omitted, a list of all the tasks is retrieved. + +```yaml +Type: String +Parameter Sets: zOrg +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +## NOTES + +## RELATED LINKS + +[Zerto Analytics REST API Endpoint for Tasks](https://docs.api.zerto.com/#/Monitoring/get_v2_monitoring_tasks) diff --git a/docs/Get-ZAVolume.md b/docs/Get-ZAVolume.md new file mode 100644 index 0000000..a0030ff --- /dev/null +++ b/docs/Get-ZAVolume.md @@ -0,0 +1,137 @@ +--- +external help file: ZertoApiWrapper-help.xml +Module Name: ZertoApiWrapper +online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZAVolume.md +schema: 2.0.0 +--- + +# Get-ZAVolume + +## SYNOPSIS + +Retrieves account volumes by datastore. Enter a site identifier and cluster identifier to get the list of volumes that exist in the datastore cluster. Or, enter a site identifier and datastore identifier to get the list of volumes that exist in the datastore. To retrieve all volumes for a specific VPG, enter a VPG identifier only. + +## SYNTAX + +### VpgIdentifier (Default) +``` +Get-ZAVolume -vpgIdentifier [] +``` + +### SiteAndDatastoreIdentifier +``` +Get-ZAVolume -siteIdentifier -datastoreIdentifier [] +``` + +### SiteAndClusterIdentifier +``` +Get-ZAVolume -siteIdentifier -clusterIdentifier [] +``` + +## DESCRIPTION + +Retrieves account volumes by datastore. Enter a site identifier and cluster identifier to get the list of volumes that exist in the datastore cluster. Or, enter a site identifier and datastore identifier to get the list of volumes that exist in the datastore. To retrieve all volumes for a specific VPG, enter a VPG identifier only. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> Get-ZAVolume -vpgIdentifier "2345-6789-0123" +``` + +Returns all volume information for all VMs in VPG with Identifier "2345-6789-0123" + +### Example 2 +```powershell +PS C:\> Get-ZAVolume -siteIdentifier "3456-7890-1234" -clusterIdentifier "0123-4567-8901" +``` + +Returns all volume information for all volumes in Site with Identifier "3456-7890-1234" on Datastore Cluster with Identifier "0123-4567-8901" + +### Example 3 +```powershell +PS C:\> Get-ZAVolume -siteIdentifier "3456-7890-1234" -datastoreIdentifier "5678-9012-3456" +``` + +Returns all volume information for all volumes in Site with Identifier "3456-7890-1234" on Datastore with Identifier "5678-9012-3456" + +## PARAMETERS + +### -clusterIdentifier +The cluster identifier. +If a cluster identifier is not entered, you must enter a datastore identifier. + +```yaml +Type: String +Parameter Sets: SiteAndClusterIdentifier +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -datastoreIdentifier +The datastore identifer. +If a datastore identifier is not entered, you must enter a cluster identifier. + +```yaml +Type: String +Parameter Sets: SiteAndDatastoreIdentifier +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -siteIdentifier +The site identifier. +The site identifier is mandatory if vpgIdentifier is not entered. + +```yaml +Type: String +Parameter Sets: SiteAndDatastoreIdentifier, SiteAndClusterIdentifier +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -vpgIdentifier +The vpg identifer. + +```yaml +Type: String +Parameter Sets: VpgIdentifier +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### None + +## OUTPUTS + +### System.Object +## NOTES + +## RELATED LINKS + +[Zerto Analytics REST API Endpoint for Volumes](https://docs.api.zerto.com/#/Monitoring/get_v2_monitoring_volumes) diff --git a/docs/Get-ZAVpg.md b/docs/Get-ZAVpg.md new file mode 100644 index 0000000..d8f207f --- /dev/null +++ b/docs/Get-ZAVpg.md @@ -0,0 +1,98 @@ +--- +external help file: ZertoApiWrapper-help.xml +Module Name: ZertoApiWrapper +online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZAVpg.md +schema: 2.0.0 +--- + +# Get-ZAVpg + +## SYNOPSIS + +Retrieve a list of all VPGs. + +## SYNTAX + +### zOrg (Default) +``` +Get-ZAVpg [-zOrgIdentifier ] [] +``` + +### vpg +``` +Get-ZAVpg -vpgIdentifier [] +``` + +## DESCRIPTION + +Retrieve a list of all VPGs. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> Get-ZAVpg +``` + +Retrieve a list of all VPGs. + +### Example 2 +```powershell +PS C:\> Get-ZAVpg -zOrgIdentifier "1234-5678-9012" +``` + +Retrieve a list of all VPGs associated with zOrg "1234-5678-9012" + +### Example 3 +```powershell +PS C:\> Get-ZAVpg -vpgIdentifier "2109-8765-4321" +``` + +Retrieve information for VPG with identifier "2109-8765-4321" + +## PARAMETERS + +### -vpgIdentifier +The VPG Identifier + +```yaml +Type: String +Parameter Sets: vpg +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -zOrgIdentifier +The ZORG identifier by which to filter the VPG list. +If the ZORG identifier is omitted, a list of all VPGs is retrieved. + +```yaml +Type: String +Parameter Sets: zOrg +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +## NOTES + +## RELATED LINKS + +[Zerto Analytics REST API Endpoint for VPGs](https://docs.api.zerto.com/#/Monitoring/get_v2_monitoring_vpgs) +[Zerto Analytics REST API Endpoint for VPG Identifier](https://docs.api.zerto.com/#/Monitoring/get_v2_monitoring_vpgs__vpgIdentifier_) diff --git a/docs/Get-ZAzOrg.md b/docs/Get-ZAzOrg.md new file mode 100644 index 0000000..e6eb02c --- /dev/null +++ b/docs/Get-ZAzOrg.md @@ -0,0 +1,46 @@ +--- +external help file: ZertoApiWrapper-help.xml +Module Name: ZertoApiWrapper +online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZAzOrg.md +schema: 2.0.0 +--- + +# Get-ZAzOrg + +## SYNOPSIS + +Retrieve a list of all ZORGs. + +## SYNTAX + +``` +Get-ZAzOrg [] +``` + +## DESCRIPTION + +Retrieve a list of all ZORGs. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> Get-ZAzOrg +``` + +Retrieve a list of all ZORGs. + +## PARAMETERS + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +## NOTES + +## RELATED LINKS + +[Zerto Analytics REST API Endpoint for ZOrgs](https://docs.api.zerto.com/#/Monitoring/get_v2_monitoring_zorgs) diff --git a/docs/Get-ZertoAlert.md b/docs/Get-ZertoAlert.md index 1dfd749..8df174b 100644 --- a/docs/Get-ZertoAlert.md +++ b/docs/Get-ZertoAlert.md @@ -1,7 +1,7 @@ --- external help file: ZertoApiWrapper-help.xml Module Name: ZertoApiWrapper -online version: https://github.com/wcarroll/ZertoApiWrapper/blob/master/docs/Get-ZertoAlert.md +online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZertoAlert.md schema: 2.0.0 --- diff --git a/docs/Get-ZertoDatastore.md b/docs/Get-ZertoDatastore.md index 8db8390..d3bc777 100644 --- a/docs/Get-ZertoDatastore.md +++ b/docs/Get-ZertoDatastore.md @@ -1,7 +1,7 @@ --- external help file: ZertoApiWrapper-help.xml Module Name: ZertoApiWrapper -online version: https://github.com/wcarroll/ZertoApiWrapper/blob/master/docs/Get-ZertoDatastore.md +online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZertoDatastore.md schema: 2.0.0 --- diff --git a/docs/Get-ZertoEvent.md b/docs/Get-ZertoEvent.md index 3e0c546..e42daa2 100644 --- a/docs/Get-ZertoEvent.md +++ b/docs/Get-ZertoEvent.md @@ -1,7 +1,7 @@ --- external help file: ZertoApiWrapper-help.xml Module Name: ZertoApiWrapper -online version: https://github.com/wcarroll/ZertoApiWrapper/blob/master/docs/Get-ZertoEvent.md +online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZertoEvent.md schema: 2.0.0 --- @@ -66,13 +66,27 @@ PS C:\> Get-ZertoEvent -eventId "Need an eventID" Returns information for each -eventID specified. -### Example 1 +### Example 3 ```powershell PS C:\> Get-ZertoEvent -startDate "2019-01-01" -endDate "2019-01-07" -vpg "My Vpg" ``` Returns all events between Jan. 01, 2019 and Jan. 07, 2019 (inclusive) for the vpg "My Vpg" +### Example 4 +```powershell +PS C:\> Get-ZertoEvent -userName "Domain.tld\MyUser +``` + +Returns all events associated with the username passed into the command. + +### Example 5 +```powershell +PS C:\> Get-ZertoEvent -startDate "2019-01-01T12:30:00" -endDate "2019-01-01T13:30:00" -vpg "My Vpg" +``` + +Returns all events between Jan. 01, 2019 12:30 PM and Jan. 01, 2019 1:30 PM (inclusive) for the vpg "My Vpg" + ## PARAMETERS ### -alertIdentifier @@ -112,6 +126,7 @@ The type of event to return. This filter behaves in the same way as the eventCat Type: String Parameter Sets: filter Aliases: +Accepted values: All, Events, Alerts Required: False Position: Named @@ -159,6 +174,7 @@ The type of entity for which you wish to return results. Possible Values are: 'V Type: String Parameter Sets: filter Aliases: +Accepted values: VPG, VRA, Unknown, Site Required: False Position: Named @@ -174,6 +190,7 @@ This filter behaves in the same way as the category filter. If both category and Type: String Parameter Sets: filter Aliases: +Accepted values: All, Events, Alerts Required: False Position: Named diff --git a/docs/Get-ZertoLicense.md b/docs/Get-ZertoLicense.md index f864948..74ca60b 100644 --- a/docs/Get-ZertoLicense.md +++ b/docs/Get-ZertoLicense.md @@ -1,7 +1,7 @@ --- external help file: ZertoApiWrapper-help.xml Module Name: ZertoApiWrapper -online version: https://github.com/wcarroll/ZertoApiWrapper/blob/master/docs/Get-ZertoLicense.md +online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZertoLicense.md schema: 2.0.0 --- diff --git a/docs/Get-ZertoLocalSite.md b/docs/Get-ZertoLocalSite.md index ad0fdd9..b094547 100644 --- a/docs/Get-ZertoLocalSite.md +++ b/docs/Get-ZertoLocalSite.md @@ -1,7 +1,7 @@ --- external help file: ZertoApiWrapper-help.xml Module Name: ZertoApiWrapper -online version: https://github.com/wcarroll/ZertoApiWrapper/blob/master/docs/Get-ZertoLocalSite.md +online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZertoLocalSite.md schema: 2.0.0 --- diff --git a/docs/Get-ZertoPeerSite.md b/docs/Get-ZertoPeerSite.md index 9142de4..828031b 100644 --- a/docs/Get-ZertoPeerSite.md +++ b/docs/Get-ZertoPeerSite.md @@ -1,7 +1,7 @@ --- external help file: ZertoApiWrapper-help.xml Module Name: ZertoApiWrapper -online version: https://github.com/wcarroll/ZertoApiWrapper/blob/master/docs/Get-ZertoPeerSite.md +online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZertoPeerSite.md schema: 2.0.0 --- diff --git a/docs/Get-ZertoProtectedVm.md b/docs/Get-ZertoProtectedVm.md index 1d814ea..728b118 100644 --- a/docs/Get-ZertoProtectedVm.md +++ b/docs/Get-ZertoProtectedVm.md @@ -1,7 +1,7 @@ --- external help file: ZertoApiWrapper-help.xml Module Name: ZertoApiWrapper -online version: https://github.com/wcarroll/ZertoApiWrapper/blob/master/docs/Get-ZertoProtectedVm.md +online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZertoProtectedVm.md schema: 2.0.0 --- @@ -88,6 +88,7 @@ The priority specified for the VPG. Possible values are: 'Low', 'Medium', or 'Hi Type: String Parameter Sets: filter Aliases: +Accepted values: Low, Medium, High Required: False Position: Named diff --git a/docs/Get-ZertoRecoveryReport.md b/docs/Get-ZertoRecoveryReport.md index 0a586f7..2c6785c 100644 --- a/docs/Get-ZertoRecoveryReport.md +++ b/docs/Get-ZertoRecoveryReport.md @@ -1,7 +1,7 @@ --- external help file: ZertoApiWrapper-help.xml Module Name: ZertoApiWrapper -online version: https://github.com/wcarroll/ZertoApiWrapper/blob/master/docs/Get-ZertoRecoveryReport.md +online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZertoRecoveryReport.md schema: 2.0.0 --- @@ -20,7 +20,7 @@ Get-ZertoRecoveryReport [] ### filter ``` Get-ZertoRecoveryReport [-startTime ] [-endTime ] [-pageNumber ] [-pageSize ] - [-vpgIdentifier ] [-vpgName ] [-recoveryType ] [-state ] [] + [-vpgName ] [-recoveryType ] [-state ] [] ``` ## DESCRIPTION @@ -102,6 +102,7 @@ Possible values are: 'Failover', 'Failover Test', or 'Move' Type: String Parameter Sets: filter Aliases: +Accepted values: Failover, Failover Test, Move Required: False Position: Named @@ -142,22 +143,6 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -vpgIdentifier -The internal identifier of the VPG. -You can specify more than one VPG, separated by commas. - -```yaml -Type: String -Parameter Sets: filter -Aliases: - -Required: False -Position: Named -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - ### -vpgName The name of the VPG. You can specify more than one VPG, separated by commas. diff --git a/docs/Get-ZertoResourcesReport.md b/docs/Get-ZertoResourcesReport.md index bf12822..ab0476f 100644 --- a/docs/Get-ZertoResourcesReport.md +++ b/docs/Get-ZertoResourcesReport.md @@ -1,7 +1,7 @@ --- external help file: ZertoApiWrapper-help.xml Module Name: ZertoApiWrapper -online version: https://github.com/wcarroll/ZertoApiWrapper/blob/master/docs/Get-ZertoResourcesReport.md +online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZertoResourcesReport.md schema: 2.0.0 --- diff --git a/docs/Get-ZertoServiceProfile.md b/docs/Get-ZertoServiceProfile.md index 98a0c97..174ae17 100644 --- a/docs/Get-ZertoServiceProfile.md +++ b/docs/Get-ZertoServiceProfile.md @@ -1,7 +1,7 @@ --- external help file: ZertoApiWrapper-help.xml Module Name: ZertoApiWrapper -online version: https://github.com/wcarroll/ZertoApiWrapper/blob/master/docs/Get-ZertoServiceProfile.md +online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZertoServiceProfile.md schema: 2.0.0 --- diff --git a/docs/Get-ZertoTask.md b/docs/Get-ZertoTask.md index 8e10bcd..a37e4f7 100644 --- a/docs/Get-ZertoTask.md +++ b/docs/Get-ZertoTask.md @@ -1,7 +1,7 @@ --- external help file: ZertoApiWrapper-help.xml Module Name: ZertoApiWrapper -online version: https://github.com/wcarroll/ZertoApiWrapper/blob/master/docs/Get-ZertoTask.md +online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZertoTask.md schema: 2.0.0 --- @@ -129,6 +129,7 @@ The status of the task. Possible values are: 'InProgress', 'Paused', 'Failed', ' Type: String Parameter Sets: filter Aliases: +Accepted values: InProgress, Paused, Failed, Completed, Cancelling Required: False Position: Named diff --git a/docs/Get-ZertoUnprotectedVm.md b/docs/Get-ZertoUnprotectedVm.md index ba21f4f..5da328b 100644 --- a/docs/Get-ZertoUnprotectedVm.md +++ b/docs/Get-ZertoUnprotectedVm.md @@ -1,7 +1,7 @@ --- external help file: ZertoApiWrapper-help.xml Module Name: ZertoApiWrapper -online version: https://github.com/wcarroll/ZertoApiWrapper/blob/master/docs/Get-ZertoUnprotectedVm.md +online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZertoUnprotectedVm.md schema: 2.0.0 --- diff --git a/docs/Get-ZertoVirtualizationSite.md b/docs/Get-ZertoVirtualizationSite.md index 88f78cf..12c1872 100644 --- a/docs/Get-ZertoVirtualizationSite.md +++ b/docs/Get-ZertoVirtualizationSite.md @@ -1,7 +1,7 @@ --- external help file: ZertoApiWrapper-help.xml Module Name: ZertoApiWrapper -online version: https://github.com/wcarroll/ZertoApiWrapper/blob/master/docs/Get-ZertoVirtualizationSite.md +online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZertoVirtualizationSite.md schema: 2.0.0 --- @@ -18,6 +18,11 @@ Returns information about the hypervisor site where the API is run and all the s Get-ZertoVirtualizationSite [] ``` +### repositories +``` +Get-ZertoVirtualizationSite -siteIdentifier [-repositories] [] +``` + ### folders ``` Get-ZertoVirtualizationSite -siteIdentifier [-folders] [] @@ -225,6 +230,21 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -repositories +The identifier of the Zerto Virtual Manager site. + +```yaml +Type: SwitchParameter +Parameter Sets: repositories +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### -resourcePools Return all resource pools at the selected site. @@ -245,7 +265,7 @@ The identifier of the Zerto Virtual Manager site. ```yaml Type: String -Parameter Sets: folders, devices, vms, resourcePools, networks, hosts, hostClusters, datastores, datastoreClusters, siteIdentifier +Parameter Sets: repositories, folders, devices, vms, resourcePools, networks, hosts, hostClusters, datastores, datastoreClusters, siteIdentifier Aliases: siteId Required: True @@ -271,7 +291,7 @@ Accept wildcard characters: False ``` ### CommonParameters -This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). ## INPUTS diff --git a/docs/Get-ZertoVolume.md b/docs/Get-ZertoVolume.md index 5663b51..57c5d8e 100644 --- a/docs/Get-ZertoVolume.md +++ b/docs/Get-ZertoVolume.md @@ -1,7 +1,7 @@ --- external help file: ZertoApiWrapper-help.xml Module Name: ZertoApiWrapper -online version: https://github.com/wcarroll/ZertoApiWrapper/blob/master/docs/Get-ZertoVolume.md +online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZertoVolume.md schema: 2.0.0 --- diff --git a/docs/Get-ZertoVpg.md b/docs/Get-ZertoVpg.md index d574889..08a0e85 100644 --- a/docs/Get-ZertoVpg.md +++ b/docs/Get-ZertoVpg.md @@ -1,7 +1,7 @@ --- external help file: ZertoApiWrapper-help.xml Module Name: ZertoApiWrapper -online version: https://github.com/wcarroll/ZertoApiWrapper/blob/master/docs/Get-ZertoVpg.md +online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZertoVpg.md schema: 2.0.0 --- @@ -271,6 +271,7 @@ The VPG priority. Possible values are: 'Low', 'Medium', 'High' Type: String Parameter Sets: filter Aliases: +Accepted values: Low, Medium, High Required: False Position: Named diff --git a/docs/Get-ZertoVpgSetting.md b/docs/Get-ZertoVpgSetting.md index e9a05dd..998eae0 100644 --- a/docs/Get-ZertoVpgSetting.md +++ b/docs/Get-ZertoVpgSetting.md @@ -1,7 +1,7 @@ --- external help file: ZertoApiWrapper-help.xml Module Name: ZertoApiWrapper -online version: https://github.com/wcarroll/ZertoApiWrapper/blob/master/docs/Get-ZertoVpgSetting.md +online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZertoVpgSetting.md schema: 2.0.0 --- @@ -17,6 +17,11 @@ Returns information when a VPG Settings object is created to create a new or edi Get-ZertoVpgSetting [] ``` +### ltr +``` +Get-ZertoVpgSetting -vpgSettingsIdentifier [-ltr] [] +``` + ### volumeIdentifier ``` Get-ZertoVpgSetting -vpgSettingsIdentifier -vmIdentifier -volumeIdentifier @@ -56,7 +61,7 @@ Get-ZertoVpgSetting -vpgSettingsIdentifier [-scripting] [ [-rcovery] [] +Get-ZertoVpgSetting -vpgSettingsIdentifier [-recovery] [] ``` ### priority @@ -151,10 +156,17 @@ PS C:\> Get-ZertoVpgSetting -vpgSettingsIdentifier "MySettingsIdentifier" -basic Returns current basic settings for vpgSettingsIdentifier "MySettingsIdentifier" +### Example 6 +```powershell +PS C:\> Get-ZertoVpgSetting -vpgSettingsIdentifier "MySettingsIdentifier" -ltr +``` + +Returns current LTR settings for vpgSettingsIdentifier "MySettingsIdentifier" + ## PARAMETERS ### -backup -Return backup information for VPG identifier specified +Return backup information for VPG identifier specified. Please note, this parameter is ONLY available in Zerto version 7.5 and earlier. Attempting to run this switch against a Zerto Virtual Manager version 8.0 or higher result in an error. ```yaml Type: SwitchParameter @@ -199,7 +211,7 @@ Accept wildcard characters: False ``` ### -dayOfWeek -Get the day of week a backup is scheduled +Get the day of week a backup is scheduled. Please note, this parameter is ONLY available in Zerto version 7.5 and earlier. Attempting to run this switch against a Zerto Virtual Manager version 8.0 or higher result in an error. ```yaml Type: SwitchParameter @@ -228,6 +240,21 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -ltr +Return LTR information for the specified VPG. Please note, this parameter is ONLY available in Zerto version 8.0 and later. Attempting to run this switch against a Zerto Virtual Manager version 7.5 or lower will result in an error. + +```yaml +Type: SwitchParameter +Parameter Sets: ltr +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### -networks Get VPG Network Settings @@ -288,13 +315,13 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -rcovery +### -recovery Get VPG Recovery Settings ```yaml Type: SwitchParameter Parameter Sets: recovery -Aliases: +Aliases: rcovery Required: True Position: Named @@ -304,7 +331,7 @@ Accept wildcard characters: False ``` ### -retentionPeriod -Get the retention period for a backup +Get the retention period for a backup. Please note, this parameter is ONLY available in Zerto version 7.5 and earlier. Attempting to run this switch against a Zerto Virtual Manager version 8.0 or higher result in an error. ```yaml Type: SwitchParameter @@ -319,7 +346,7 @@ Accept wildcard characters: False ``` ### -schedulerPeriod -Get the backup schedule +Get the backup schedule. Please note, this parameter is ONLY available in Zerto version 7.5 and earlier. Attempting to run this switch against a Zerto Virtual Manager version 8.0 or higher result in an error. ```yaml Type: SwitchParameter @@ -413,7 +440,7 @@ The identifier of the VPG settings object for which information is retrieved. ```yaml Type: String[] -Parameter Sets: volumeIdentifier, volumes, nicIdentifier, nics, vmIdentifier, vms, scripting, recovery, priority, networks, journal, bootGroup, basic, schedulerPeriod, retentionPeriod, dayOfWeek, backup, vpgSettingsIdentifier +Parameter Sets: ltr, volumeIdentifier, volumes, nicIdentifier, nics, vmIdentifier, vms, scripting, recovery, priority, networks, journal, bootGroup, basic, schedulerPeriod, retentionPeriod, dayOfWeek, backup, vpgSettingsIdentifier Aliases: vpgSettingsId, settingsId Required: True @@ -424,7 +451,7 @@ Accept wildcard characters: False ``` ### CommonParameters -This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). ## INPUTS diff --git a/docs/Get-ZertoVra.md b/docs/Get-ZertoVra.md index 676e491..c2c8325 100644 --- a/docs/Get-ZertoVra.md +++ b/docs/Get-ZertoVra.md @@ -1,7 +1,7 @@ --- external help file: ZertoApiWrapper-help.xml Module Name: ZertoApiWrapper -online version: https://github.com/wcarroll/ZertoApiWrapper/blob/master/docs/Get-ZertoVra.md +online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZertoVra.md schema: 2.0.0 --- diff --git a/docs/Get-ZertoZorg.md b/docs/Get-ZertoZorg.md index 5ddcd16..ebd30f9 100644 --- a/docs/Get-ZertoZorg.md +++ b/docs/Get-ZertoZorg.md @@ -1,7 +1,7 @@ --- external help file: ZertoApiWrapper-help.xml Module Name: ZertoApiWrapper -online version: https://github.com/wcarroll/ZertoApiWrapper/blob/master/docs/Get-ZertoZorg.md +online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZertoZorg.md schema: 2.0.0 --- diff --git a/docs/Get-ZertoZsspSession.md b/docs/Get-ZertoZsspSession.md index 09ce28b..487e2eb 100644 --- a/docs/Get-ZertoZsspSession.md +++ b/docs/Get-ZertoZsspSession.md @@ -1,7 +1,7 @@ --- external help file: ZertoApiWrapper-help.xml Module Name: ZertoApiWrapper -online version: https://github.com/wcarroll/ZertoApiWrapper/blob/master/docs/Get-ZertpZsspSession.md +online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZertoZsspSession.md schema: 2.0.0 --- diff --git a/docs/Import-ZertoVmNicSetting.md b/docs/Import-ZertoVmNicSetting.md new file mode 100644 index 0000000..66876dc --- /dev/null +++ b/docs/Import-ZertoVmNicSetting.md @@ -0,0 +1,96 @@ +--- +external help file: ZertoApiWrapper-help.xml +Module Name: ZertoApiWrapper +online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Import-ZertoVmNicSetting.md +schema: 2.0.0 +--- + +# Import-ZertoVmNicSetting + +## SYNOPSIS +Using a CSV file, will import updated Live and Test network settings for protected virtual machines. + +## SYNTAX + +``` +Import-ZertoVmNicSetting [-InputFile] [-WhatIf] [-Confirm] [] +``` + +## DESCRIPTION +Using a CSV file, will import updated Live and Test network settings for protected virtual machines. This function will read the provided CSV file and only update VMs defined in the file. + +Each entry in the CSV will be for one VM and a single NIC attached to that VM. Each entry MUST contain the following information: VPG Name, VM Name, Network Adapter Name, Mac Address Update for both Live and Test, and Network Name for both Live and Test. All other information is optional, but will be applied based on the following logic: + * If 'IsDhcp' is set to 'TRUE', the NIC setting will be set to DHCP and Primary DNS, Secondary DNS, and Search Domain settings will be applied along with the mandatory fields. + * If 'IsDhcp' is set to 'FALSE' or not set and there is an IP Address defined, the IP Address, Subnet Mask, Default Gateway, Primary DNS, Secondary DNS, and Search Domain settings will be applied along with the mandatory fields. + * if 'IsDhcp' is set to 'FALSE' or not set and there is NOT an IP Address defined, the current NIC settings will be removed and ONLY the mandatory fields will be applied. + +This logic is applied to both the Live and Test settings individually. It is recommended to use the `Export-ZertoVpgNicSetting` to dump all current settings and then modify a copy of the exported file with only the settings you wish to update. Import the copied file and if you need to revert, Import the original. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> Import-ZertoVmNicSetting -InputFile 'C:\ZertoScripts\UpdatedNicInformation.csv' +``` + +Imports the data in the CSV located at 'C:\ZertoScripts\UpdatedNicInformation.csv' and updates each VM and each NIC as defined in the CSV file. + +## PARAMETERS + +### -InputFile +File to process for import + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: 1 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. The cmdlet is not run. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +## NOTES + +## RELATED LINKS + +[Zerto Virtual Manager REST API VpgSettings end point documentation](http://s3.amazonaws.com/zertodownload_docs/Latest/Zerto%20Virtual%20Replication%20Zerto%20Virtual%20Manager%20%28ZVM%29%20-%20vSphere%20Online%20Help/index.html#page/RestfulAPIs%2FStatusAPIs.5.110.html%23) diff --git a/docs/Import-ZertoVpg.md b/docs/Import-ZertoVpg.md index 6d42d89..979a347 100644 --- a/docs/Import-ZertoVpg.md +++ b/docs/Import-ZertoVpg.md @@ -1,7 +1,7 @@ --- external help file: ZertoApiWrapper-help.xml Module Name: ZertoApiWrapper -online version: https://github.com/wcarroll/ZertoApiWrapper/blob/Master/docs/Import-ZertoVpg.md +online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/Master/docs/Import-ZertoVpg.md schema: 2.0.0 --- diff --git a/docs/Install-ZertoVra.md b/docs/Install-ZertoVra.md index 1e2527e..b9b6136 100644 --- a/docs/Install-ZertoVra.md +++ b/docs/Install-ZertoVra.md @@ -1,7 +1,7 @@ --- external help file: ZertoApiWrapper-help.xml Module Name: ZertoApiWrapper -online version: https://github.com/wcarroll/ZertoApiWrapper/blob/master/docs/Install-ZertoVra.md +online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Install-ZertoVra.md schema: 2.0.0 --- @@ -12,12 +12,26 @@ Install Zerto VRA to a single host in the site with either a Static IP address, ## SYNTAX +### DhcpWithRoot +``` +Install-ZertoVra -hostName -datastoreName -networkName [-memoryInGB ] + [-groupName ] [-Dhcp] [-UseRootCredential] -HostRootPassword [-WhatIf] [-Confirm] + [] +``` + ### Dhcp ``` Install-ZertoVra -hostName -datastoreName -networkName [-memoryInGB ] [-groupName ] [-Dhcp] [-WhatIf] [-Confirm] [] ``` +### StaticIpWithRoot +``` +Install-ZertoVra -hostName -datastoreName -networkName [-memoryInGB ] + [-groupName ] -vraIpAddress -defaultGateway -subnetMask + [-UseRootCredential] -HostRootPassword [-WhatIf] [-Confirm] [] +``` + ### StaticIp ``` Install-ZertoVra -hostName -datastoreName -networkName [-memoryInGB ] @@ -44,6 +58,20 @@ PS C:\> Install-ZertoVra -hostName "Host01" -datastoreName "Datastore01" -networ Installs a VRA on the Host "Host01" using datastore "Datastore01" on network "VM Network" assigning a DHCP address. +### Example 3 +```powershell +PS C:\> Install-ZertoVra -hostName "Host01" -datastoreName "Datastore01" -networkName "VM Network" -vraIpAddress "192.168.1.50" -defaultGateway "192.168.1.254" -subnetMask "255.255.255.0" -UseRootCredential -HostRootPassword $RootPasswordAsSecureString +``` + +Installs a VRA on the Host "Host01" using datastore "Datastore01" on network "VM Network" assigning an IP address if "192.168.1.50", subnetmask of "255.255.255.0" and default gateway of "192.168.1.254" using the Root Credential install method. + +### Example 4 +```powershell +PS C:\> Install-ZertoVra -hostName "Host01" -datastoreName "Datastore01" -networkName "VM Network" -dhcp -UseRootCredential -HostRootPassword $RootPasswordAsSecureString +``` + +Installs a VRA on the Host "Host01" using datastore "Datastore01" on network "VM Network" assigning a DHCP address using the Root Credential install method. + ## PARAMETERS ### -datastoreName @@ -66,7 +94,7 @@ Default gateway to assign to the VRA ```yaml Type: String -Parameter Sets: StaticIp +Parameter Sets: StaticIpWithRoot, StaticIp Aliases: Required: True @@ -81,7 +109,7 @@ Assign a DHCP address to the VRA. ```yaml Type: SwitchParameter -Parameter Sets: Dhcp +Parameter Sets: DhcpWithRoot, Dhcp Aliases: Required: True @@ -122,6 +150,21 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -HostRootPassword +The password for the root user of the ESXi host where the VRA is to be installed. + +```yaml +Type: SecureString +Parameter Sets: DhcpWithRoot, StaticIpWithRoot +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### -memoryInGB Initial amount of memory to assign to the VRA in GB. Default is 3, Minimum is 1, Maximum is 16 @@ -158,7 +201,22 @@ Subnetmask to be assigned to the VRA ```yaml Type: String -Parameter Sets: StaticIp +Parameter Sets: StaticIpWithRoot, StaticIp +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -UseRootCredential +Use this switch to install the VRA using the root password install method. + +```yaml +Type: SwitchParameter +Parameter Sets: DhcpWithRoot, StaticIpWithRoot Aliases: Required: True @@ -173,7 +231,7 @@ Static IP address to assign to the VRA. ```yaml Type: String -Parameter Sets: StaticIp +Parameter Sets: StaticIpWithRoot, StaticIp Aliases: Required: True diff --git a/docs/Invoke-ZARestRequest.md b/docs/Invoke-ZARestRequest.md new file mode 100644 index 0000000..cad1b96 --- /dev/null +++ b/docs/Invoke-ZARestRequest.md @@ -0,0 +1,100 @@ +--- +external help file: ZertoApiWrapper-help.xml +Module Name: ZertoApiWrapper +online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Invoke-ZARestRequest.md +schema: 2.0.0 +--- + +# Invoke-ZARestRequest + +## SYNOPSIS +Function used to submit a REST request to the Zerto Analytics Portal. Should be used when attempting to submit a request inside a ZertoApiWrapper function or if attempting to perform an operation not currently covered in a ZertoApiWrapper function. + +## SYNTAX + +``` +Invoke-ZARestRequest [-uri] [[-method] ] [[-body] ] [] +``` + +## DESCRIPTION +Function used to submit a REST request to the Zerto Analytics Portal. Should be used when attempting to submit a request inside a ZertoApiWrapper function or if attempting to perform an operation not currently covered in a ZertoApiWrapper function. To function properly, you will have to have completed a connection to a Zerto Virtual Manager with the `Connect-ZertoAnalytics` function. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> Invoke-ZertoRestRequest -uri 'apiEndpoint/subApiEndpoint' -Method GET +``` + +Submits a GET request to the connected Zerto Virtual Manager api endpoint 'apiEndpoint/subApiEndpoint'. Check the API documentation for the endpoint to ensure the URI is formatted correctly. Typically a GET request does not require a BODY parameter. + +### Example 1 +```powershell +PS C:\> Invoke-ZertoRestRequest -uri 'apiEndpoint/subApiEndpoint' -Method POST -Body $Body +``` + +Submits a PUT request to the connected Zerto Virtual Manager api endpoint 'apiEndpoint/subApiEndpoint' with a Body parameter. Check the API documentation for the endpoint to ensure the URI is formatted correctly and the format of the Body variable. The command above assumes that the $Body variable is an object that can be formatted into JSON. + +## PARAMETERS + +### -body +Body to be submitted to the REST API endpoint. +This needs to be submitted in JSON format + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: 3 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -method +API method to be used. +GET, PUT, POST, or DELETE. +Refer to documentation for the API endpoint to ensure the correct method is being used. +If unspecified, defaults to GET + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: 2 +Default value: GET +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -uri +Parameter help description + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: 1 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +## NOTES + +## RELATED LINKS + +[Zerto Analytics API Endpoint Documentation](https://docs.api.zerto.com/) diff --git a/docs/Invoke-ZertoEvacuateVra.md b/docs/Invoke-ZertoEvacuateVra.md new file mode 100644 index 0000000..aa0b2e9 --- /dev/null +++ b/docs/Invoke-ZertoEvacuateVra.md @@ -0,0 +1,148 @@ +--- +external help file: ZertoApiWrapper-help.xml +Module Name: ZertoApiWrapper +online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Invoke-ZertoEvacuateVra.md +schema: 2.0.0 +--- + +# Invoke-ZertoEvacuateVra + +## SYNOPSIS +This operation will move all VMs currently replicating to the selected host or VRA to different hosts based on internal Zerto algorithms. + +## SYNTAX + +### VraIdentifier (Default) +``` +Invoke-ZertoEvacuateVra -VraIdentifier [-WhatIf] [-Confirm] [] +``` + +### HostName +``` +Invoke-ZertoEvacuateVra -HostName [-WhatIf] [-Confirm] [] +``` + +### VraName +``` +Invoke-ZertoEvacuateVra -VraName [-WhatIf] [-Confirm] [] +``` + +## DESCRIPTION +This operation will move all VMs currently replicating to the selected host or VRA to different hosts based on internal Zerto algorithms. + +This will return a Zerto Task Identifier so the task progress can be tracked. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> Invoke-ZertoEvacuateVra -HostName 'host01' +``` + +Will move all VMs currently replicating to the selected host to different hosts. + +### Example 2 +```powershell +PS C:\> Invoke-ZertoEvacuateVra -VraName 'Z-VRA-host01' +``` + +Will move all VMs currently replicating to the selected VRA to different VRAs. + +### Example 3 +```powershell +PS C:\> Invoke-ZertoEvacuateVra -VraIdentifier '1234-1234-4312-9856' +``` + +Will move all VMs currently replicating to the selected VRA to different VRAs. + +## PARAMETERS + +### -HostName +HostName Option + +```yaml +Type: String +Parameter Sets: HostName +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -VraIdentifier +VRAIdentifier Option + +```yaml +Type: String +Parameter Sets: VraIdentifier +Aliases: VraId, Identifier + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByPropertyName, ByValue) +Accept wildcard characters: False +``` + +### -VraName +VRA Option + +```yaml +Type: String +Parameter Sets: VraName +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +## NOTES + +## RELATED LINKS + +[Zerto REST API Evacuate VRA End Point Documentation](http://s3.amazonaws.com/zertodownload_docs/Latest/Zerto%20Virtual%20Replication%20Zerto%20Virtual%20Manager%20%28ZVM%29%20-%20vSphere%20Online%20Help/index.html#page/RestfulAPIs%2FStatusAPIs.5.129.html%23) + diff --git a/docs/Invoke-ZertoFailover.md b/docs/Invoke-ZertoFailover.md index 41edbae..ac68d01 100644 --- a/docs/Invoke-ZertoFailover.md +++ b/docs/Invoke-ZertoFailover.md @@ -1,7 +1,7 @@ --- external help file: ZertoApiWrapper-help.xml Module Name: ZertoApiWrapper -online version: https://github.com/wcarroll/ZertoApiWrapper/blob/master/docs/Invoke-ZertoFailover.md +online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Invoke-ZertoFailover.md schema: 2.0.0 --- diff --git a/docs/Invoke-ZertoFailoverCommit.md b/docs/Invoke-ZertoFailoverCommit.md index 9f1b3d1..f7876b3 100644 --- a/docs/Invoke-ZertoFailoverCommit.md +++ b/docs/Invoke-ZertoFailoverCommit.md @@ -1,7 +1,7 @@ --- external help file: ZertoApiWrapper-help.xml Module Name: ZertoApiWrapper -online version: https://github.com/wcarroll/ZertoApiWrapper/blob/master/docs/Invoke-ZertoFailoverCommit.md +online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Invoke-ZertoFailoverCommit.md schema: 2.0.0 --- @@ -13,7 +13,7 @@ Commit a running VPG failover ## SYNTAX ``` -Invoke-ZertoFailoverCommit [-vpgName] [-reverseProtection] [] +Invoke-ZertoFailoverCommit [-vpgName] [-reverseProtection] [-WhatIf] [-Confirm] [] ``` ## DESCRIPTION @@ -67,6 +67,36 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. The cmdlet is not run. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### CommonParameters This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). diff --git a/docs/Invoke-ZertoFailoverRollback.md b/docs/Invoke-ZertoFailoverRollback.md index 51c8a09..8757c40 100644 --- a/docs/Invoke-ZertoFailoverRollback.md +++ b/docs/Invoke-ZertoFailoverRollback.md @@ -1,7 +1,7 @@ --- external help file: ZertoApiWrapper-help.xml Module Name: ZertoApiWrapper -online version: https://github.com/wcarroll/ZertoApiWrapper/blob/master/docs/Invoke-ZertoFailoverRollback.md +online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Invoke-ZertoFailoverRollback.md schema: 2.0.0 --- diff --git a/docs/Invoke-ZertoForceSync.md b/docs/Invoke-ZertoForceSync.md index 2d88313..a124bb3 100644 --- a/docs/Invoke-ZertoForceSync.md +++ b/docs/Invoke-ZertoForceSync.md @@ -1,7 +1,7 @@ --- external help file: ZertoApiWrapper-help.xml Module Name: ZertoApiWrapper -online version: https://github.com/wcarroll/ZertoApiWrapper/blob/master/docs/Invoke-ZertoForceSync.md +online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Invoke-ZertoForceSync.md schema: 2.0.0 --- diff --git a/docs/Invoke-ZertoMove.md b/docs/Invoke-ZertoMove.md index 6239eda..030ba21 100644 --- a/docs/Invoke-ZertoMove.md +++ b/docs/Invoke-ZertoMove.md @@ -1,7 +1,7 @@ --- external help file: ZertoApiWrapper-help.xml Module Name: ZertoApiWrapper -online version: https://github.com/wcarroll/ZertoApiWrapper/blob/master/docs/Invoke-ZertoMove.md +online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Invoke-ZertoMove.md schema: 2.0.0 --- @@ -12,23 +12,30 @@ Start a move of a VPG. ## SYNTAX -### main (Default) +### id (Default) ``` -Invoke-ZertoMove [-vpgName] [[-commitPolicy] ] [[-commitPolicyTimeout] ] - [-forceShutdown] [-ContinueOnPreScriptFailure] [-WhatIf] [-Confirm] [] +Invoke-ZertoMove -vpgIdentifier [-forceShutdown] [-disableReverseProtection] [-keepSourceVms] + [-ContinueOnPreScriptFailure] [-WhatIf] [-Confirm] [] ``` -### disableReverseProtection +### commitName ``` -Invoke-ZertoMove [-vpgName] [[-commitPolicy] ] [[-commitPolicyTimeout] ] - [-forceShutdown] [-disableReverseProtection] [-ContinueOnPreScriptFailure] [-WhatIf] [-Confirm] +Invoke-ZertoMove -vpgName -commitPolicy [-commitPolicyTimeout ] [-forceShutdown] + [-disableReverseProtection] [-keepSourceVms] [-ContinueOnPreScriptFailure] [-WhatIf] [-Confirm] [] ``` -### keepSourceVms +### name ``` -Invoke-ZertoMove [-vpgName] [[-commitPolicy] ] [[-commitPolicyTimeout] ] - [-forceShutdown] [-keepSourceVms] [-ContinueOnPreScriptFailure] [-WhatIf] [-Confirm] [] +Invoke-ZertoMove -vpgName [-forceShutdown] [-disableReverseProtection] [-keepSourceVms] + [-ContinueOnPreScriptFailure] [-WhatIf] [-Confirm] [] +``` + +### commitId +``` +Invoke-ZertoMove -vpgIdentifier -commitPolicy [-commitPolicyTimeout ] [-forceShutdown] + [-disableReverseProtection] [-keepSourceVms] [-ContinueOnPreScriptFailure] [-WhatIf] [-Confirm] + [] ``` ## DESCRIPTION @@ -38,10 +45,24 @@ Start a move of a VPG. ### Example 1 ```powershell -PS C:\> Invoke-ZertoMove -vpgName "MyVpg" +PS C:\> Invoke-ZertoMove -vpgName 'MyVpg' +``` + +Specify the name of a vpg to move + +### Example 2 +```powershell +PS C:\> Invoke-ZertoMove -vpgIdentifier '2fbbf6b5-cddc-4653-b1fe-564f069eeb64' +``` + +Specify the identifier of a vpg to move + +### Example 3 +```powershell +PS C:\> Get-ZertoVpg | Invoke-ZertoMove ``` -Starts a move operation of VPG "MyVpg" +Utilize the pipeline to move multiple vpgs ## PARAMETERS @@ -56,11 +77,12 @@ Default is the Site Settings setting. ```yaml Type: String -Parameter Sets: (All) +Parameter Sets: commitName, commitId Aliases: +Accepted values: Rollback, Commit, None -Required: False -Position: 1 +Required: True +Position: Named Default value: None Accept pipeline input: False Accept wildcard characters: False @@ -72,11 +94,11 @@ If omitted, the site settings default will be applied. ```yaml Type: Int32 -Parameter Sets: (All) +Parameter Sets: commitName, commitId Aliases: Required: False -Position: 2 +Position: Named Default value: None Accept pipeline input: False Accept wildcard characters: False @@ -91,7 +113,7 @@ Parameter Sets: (All) Aliases: Required: False -Position: 6 +Position: Named Default value: None Accept pipeline input: False Accept wildcard characters: False @@ -102,10 +124,10 @@ Do not enable reverse protection. The VPG definition is kept with the status Nee ```yaml Type: SwitchParameter -Parameter Sets: disableReverseProtection +Parameter Sets: (All) Aliases: -Required: True +Required: False Position: Named Default value: None Accept pipeline input: False @@ -121,7 +143,7 @@ Parameter Sets: (All) Aliases: Required: False -Position: 3 +Position: Named Default value: None Accept pipeline input: False Accept wildcard characters: False @@ -132,26 +154,41 @@ Use this switch to Prevent the protected virtual machines from being deleted in ```yaml Type: SwitchParameter -Parameter Sets: keepSourceVms +Parameter Sets: (All) Aliases: -Required: True -Position: 5 +Required: False +Position: Named Default value: None Accept pipeline input: False Accept wildcard characters: False ``` +### -vpgIdentifier +ID(s) of the VPG(s) you want to move. + +```yaml +Type: Guid[] +Parameter Sets: id, commitId +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByPropertyName) +Accept wildcard characters: False +``` + ### -vpgName Name(s) of the VPG(s) you want to move. ```yaml Type: String[] -Parameter Sets: (All) +Parameter Sets: commitName, name Aliases: Required: True -Position: 0 +Position: Named Default value: None Accept pipeline input: False Accept wildcard characters: False diff --git a/docs/Invoke-ZertoMoveCommit.md b/docs/Invoke-ZertoMoveCommit.md index 08c6e92..c298a0f 100644 --- a/docs/Invoke-ZertoMoveCommit.md +++ b/docs/Invoke-ZertoMoveCommit.md @@ -12,9 +12,19 @@ Commit a VPG currently undergoing a move operation. ## SYNTAX +### Main (Default) ``` -Invoke-ZertoMoveCommit [-vpgName] [-reverseProtection] [-keepSourceVms] [-WhatIf] [-Confirm] - [] +Invoke-ZertoMoveCommit -vpgName [-WhatIf] [-Confirm] [] +``` + +### ReverseProtect +``` +Invoke-ZertoMoveCommit -vpgName [-reverseProtection] [-WhatIf] [-Confirm] [] +``` + +### KeepSource +``` +Invoke-ZertoMoveCommit -vpgName [-keepSourceVms] [-WhatIf] [-Confirm] [] ``` ## DESCRIPTION @@ -27,20 +37,33 @@ Commit a VPG currently undergoing a move operation. PS C:\> Invoke-ZertoMoveCommit -vpgName "MyVpg" ``` -Commit VPG "MyVpg" after a move has been started. +Commit VPG "MyVpg" after a move operation has been completed. This commit process with use the `-KeepSourceVms` or `-ReverseProtection` selection made during the move initation. + +### Example 2 +```powershell +PS C:\> Invoke-ZertoMoveCommit -vpgName "MyVpg" -keepSourceVms +``` + +Commit VPG "MyVpg" after a move operation has been completed specifying to keep the vms at the source location and NOT reverse protection. This commit process will overrule any reverse protection or keep source vms selection made during the move initiation. + +### Example 3 +```powershell +PS C:\> Invoke-ZertoMoveCommit -vpgName "MyVpg" -reverseProtection +``` + +Commit VPG "MyVpg" after a move operation has been completed specifying to reverse protection of the VMs back to the source location. The VMs at the source location will be removed from inventory at the source location and the disks will be used as pre-seed volumes. This commit process will overrule any reverse protection or keep source vms selection made during the move initiation. ## PARAMETERS ### -keepSourceVms -Use this switch to keep the source VMs. -If not set, they will be destroyed. +"Use this switch to keep the source VMs at the source site. If neither 'ReverseProtction' nor 'KeepSourceVms' switch is specified, the commit process will use selection made during move initiation." ```yaml Type: SwitchParameter -Parameter Sets: (All) +Parameter Sets: KeepSource Aliases: -Required: False +Required: True Position: Named Default value: None Accept pipeline input: False @@ -48,14 +71,14 @@ Accept wildcard characters: False ``` ### -reverseProtection -Set this to True to reverse protect the VPG(s) to the source site. If not set, will use selection made during move initiation. True or False +"Use this switch to reverse protect the VPG(s) to the source site. If neither 'ReverseProtction' nor 'KeepSourceVms' switch is specified, the commit process will use selection made during move initiation." ```yaml Type: SwitchParameter -Parameter Sets: (All) +Parameter Sets: ReverseProtect Aliases: -Required: False +Required: True Position: Named Default value: None Accept pipeline input: False @@ -71,7 +94,7 @@ Parameter Sets: (All) Aliases: Required: True -Position: 0 +Position: Named Default value: None Accept pipeline input: False Accept wildcard characters: False diff --git a/docs/Invoke-ZertoMoveRollback.md b/docs/Invoke-ZertoMoveRollback.md index 4df0772..2229cc1 100644 --- a/docs/Invoke-ZertoMoveRollback.md +++ b/docs/Invoke-ZertoMoveRollback.md @@ -1,7 +1,7 @@ --- external help file: ZertoApiWrapper-help.xml Module Name: ZertoApiWrapper -online version: https://github.com/wcarroll/ZertoApiWrapper/blob/master/docs/Invoke-ZertoMoveRollback.md +online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Invoke-ZertoMoveRollback.md schema: 2.0.0 --- diff --git a/docs/Invoke-ZertoRestRequest.md b/docs/Invoke-ZertoRestRequest.md new file mode 100644 index 0000000..fb28ad2 --- /dev/null +++ b/docs/Invoke-ZertoRestRequest.md @@ -0,0 +1,154 @@ +--- +external help file: ZertoApiWrapper-help.xml +Module Name: ZertoApiWrapper +online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Invoke-ZertoRestRequest.md +schema: 2.0.0 +--- + +# Invoke-ZertoRestRequest + +## SYNOPSIS +Function used to submit a REST request to the Zerto Virtual Manager. Should be used when attempting to submit a request inside a ZertoApiWrapper function or if attempting to perform an operation not currently covered in a ZertoApiWrapper function. + +## SYNTAX + +``` +Invoke-ZertoRestRequest [[-method] ] [-uri] [[-body] ] [[-credential] ] + [-returnHeaders] [] +``` + +## DESCRIPTION +Function used to submit a REST request to the Zerto Virtual Manager. Should be used when attempting to submit a request inside a ZertoApiWrapper function or if attempting to perform an operation not currently covered in a ZertoApiWrapper function. To function properly, you will have to have completed a connection to a Zerto Virtual Manager with the `Connect-ZertoServer` function. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> Invoke-ZertoRestRequest -uri 'apiEndpoint/subApiEndpoint' -Method POST -Body $Body +``` + +Submits a POST request to the connected Zerto Virtual Manager api endpoint 'apiEndpoint/subApiEndpoint' with a Body parameter. Check the API documentation for the endpoint to ensure the URI is formatted correctly and the format of the Body variable. The command above assumes that the $Body variable is a string properly formatted for JSON + +### Example 2 +```powershell +PS C:\> Invoke-ZertoRestRequest -uri 'apiEndpoint/subApiEndpoint' -Method POST -Body ($Body | ConvertTo-Json) +``` + +Submits a POST request to the connected Zerto Virtual Manager api endpoint 'apiEndpoint/subApiEndpoint' with a Body parameter. Check the API documentation for the endpoint to ensure the URI is formatted correctly and the format of the Body variable. The command above assumes that the $Body variable is an object that can be formatted into JSON. + +### Example 3 +```powershell +PS C:\> Invoke-ZertoRestRequest -uri 'apiEndpoint/subApiEndpoint' -Method PUT -Body $Body +``` + +Submits a PUT request to the connected Zerto Virtual Manager api endpoint 'apiEndpoint/subApiEndpoint' with a Body parameter. Check the API documentation for the endpoint to ensure the URI is formatted correctly and the format of the Body variable. The command above assumes that the $Body variable is a string properly formatted for JSON + +### Example 4 +```powershell +PS C:\> Invoke-ZertoRestRequest -uri 'apiEndpoint/subApiEndpoint' -Method DELETE +``` + +Submits a DELETE request to the connected Zerto Virtual Manager api endpoint 'apiEndpoint/subApiEndpoint'. Check the API documentation for the endpoint to ensure the URI is formatted correctly. Typically a DELETE request does not require a BODY parameter. + +### Example 5 +```powershell +PS C:\> Invoke-ZertoRestRequest -uri 'apiEndpoint/subApiEndpoint' -Method GET +``` + +Submits a GET request to the connected Zerto Virtual Manager api endpoint 'apiEndpoint/subApiEndpoint'. Check the API documentation for the endpoint to ensure the URI is formatted correctly. Typically a GET request does not require a BODY parameter. + +## PARAMETERS + +### -body +Body to be submitted to the REST API endpoint. +This needs to be submitted in JSON format + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: 3 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -credential +PSCredential object. +This is ONLY used when authenticating with the ZVM. +No other endpoints require this and generally is not used. + +```yaml +Type: PSCredential +Parameter Sets: (All) +Aliases: + +Required: False +Position: 4 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -method +Parameter help description + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: 1 +Default value: GET +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -returnHeaders +Use this switch if you would like the request headers returned along with the body. +Useful for troubleshooting to get HTTP error codes. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: False +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -uri +URI endpoint to be utilized. +When submitting the URI, only the endpoint needs to be submitted. +Please review the help documentation for examples. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: 2 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +## NOTES + +## RELATED LINKS + +[Zerto Virtual Replication API Endpoint Documentation](https://s3.amazonaws.com/zertodownload_docs/Latest/Zerto%20Virtual%20Replication%20Zerto%20Virtual%20Manager%20(ZVM)%20-%20vSphere%20Online%20Help/content/intro/book_in_portal_-_zvr_restful_apis.htm) diff --git a/docs/New-ZertoPairingToken.md b/docs/New-ZertoPairingToken.md new file mode 100644 index 0000000..53454d2 --- /dev/null +++ b/docs/New-ZertoPairingToken.md @@ -0,0 +1,78 @@ +--- +external help file: ZertoApiWrapper-help.xml +Module Name: ZertoApiWrapper +online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/New-ZertoPairingToken.md +schema: 2.0.0 +--- + +# New-ZertoPairingToken + +## SYNOPSIS +Generates a new pairing token to be used during pairing ZVM to ZVM operations. + +## SYNTAX + +``` +New-ZertoPairingToken [-WhatIf] [-Confirm] [] +``` + +## DESCRIPTION +Generates a new pairing token to be used during pairing ZVM to ZVM operations. This token is valid until used or 48 hours have passed, whichever comes first. This feature is only required when pairing two Zerto sites that are both operating Zerto version 7.5 or greater. To use this feature you will need to generate a pairing token from the destination site. Once that token is generated you will use that token to pair the source site to the destination site either via the GUI or via the `Add-ZertoPeerSite` function. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> New-ZertoPairingToken +``` + +Generates an object that will contain the pairing token and expiration date and time. + +## PARAMETERS + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### None + +## OUTPUTS + +### System.Object +## NOTES + +## RELATED LINKS + +[Zerto REST API Peer Sites End Point Documentation](http://s3.amazonaws.com/zertodownload_docs/Latest/Zerto%20Virtual%20Replication%20Zerto%20Virtual%20Manager%20%28ZVM%29%20-%20vSphere%20Online%20Help/index.html#page/RestfulAPIs%2FStatusAPIs.5.046.html%23) diff --git a/docs/New-ZertoVpg.md b/docs/New-ZertoVpg.md index cd68b3d..8c95ba6 100644 --- a/docs/New-ZertoVpg.md +++ b/docs/New-ZertoVpg.md @@ -1,51 +1,51 @@ --- external help file: ZertoApiWrapper-help.xml Module Name: ZertoApiWrapper -online version: https://github.com/wcarroll/ZertoApiWrapper/blob/master/docs/New-ZertoVpg.md +online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/New-ZertoVpg.md schema: 2.0.0 --- # New-ZertoVpg ## SYNOPSIS -Creates a New VPG with default settings only. Customization of VM settings can be accomplished with other module level functions. +Creates a New VPG with default settings only. Customization of VM settings can be accomplished with other module level functions. Returns a VpgSettingsIdentifier to be passed into the `Save-ZertoVpgSetting` function to create the VPG. ## SYNTAX -### recoveryClusterDatastoreCluster +### recoveryHostDatastore (Default) ``` New-ZertoVpg -vpgName [-vpgPriority ] [-journalHistoryInHours ] -protectedVm - -recoverySite -recoveryCluster -datastoreCluster -recoveryFolder + -recoverySite -recoveryHost -datastore -recoveryFolder [-rpoInSeconds ] [-testIntervalInMinutes ] [-serviceProfile ] [-useWanCompression ] [-zorg ] -recoveryNetwork -testNetwork [-journalDatastore ] [-journalHardLimitInMb ] [-journalWarningThresholdInMb ] [-WhatIf] [-Confirm] [] ``` -### recoveryClusterDatastore +### recoveryClusterDatastoreCluster ``` New-ZertoVpg -vpgName [-vpgPriority ] [-journalHistoryInHours ] -protectedVm - -recoverySite -recoveryCluster -datastore -recoveryFolder + -recoverySite -recoveryCluster -datastoreCluster -recoveryFolder [-rpoInSeconds ] [-testIntervalInMinutes ] [-serviceProfile ] [-useWanCompression ] [-zorg ] -recoveryNetwork -testNetwork [-journalDatastore ] [-journalHardLimitInMb ] [-journalWarningThresholdInMb ] [-WhatIf] [-Confirm] [] ``` -### recoveryHostDatastoreCluster +### recoveryClusterDatastore ``` New-ZertoVpg -vpgName [-vpgPriority ] [-journalHistoryInHours ] -protectedVm - -recoverySite -recoveryHost -datastoreCluster -recoveryFolder + -recoverySite -recoveryCluster -datastore -recoveryFolder [-rpoInSeconds ] [-testIntervalInMinutes ] [-serviceProfile ] [-useWanCompression ] [-zorg ] -recoveryNetwork -testNetwork [-journalDatastore ] [-journalHardLimitInMb ] [-journalWarningThresholdInMb ] [-WhatIf] [-Confirm] [] ``` -### recoveryHostDatastore +### recoveryHostDatastoreCluster ``` New-ZertoVpg -vpgName [-vpgPriority ] [-journalHistoryInHours ] -protectedVm - -recoverySite -recoveryHost -datastore -recoveryFolder + -recoverySite -recoveryHost -datastoreCluster -recoveryFolder [-rpoInSeconds ] [-testIntervalInMinutes ] [-serviceProfile ] [-useWanCompression ] [-zorg ] -recoveryNetwork -testNetwork [-journalDatastore ] [-journalHardLimitInMb ] [-journalWarningThresholdInMb ] @@ -176,7 +176,7 @@ Name of the datastore where the VM(s), Volume(s), and Journal(s) will reside. ```yaml Type: String -Parameter Sets: recoveryClusterDatastore, recoveryHostDatastore, recoveryResourcePoolDatastore +Parameter Sets: recoveryHostDatastore, recoveryClusterDatastore, recoveryResourcePoolDatastore Aliases: Required: True @@ -312,7 +312,7 @@ Name of the host where the VM(s) will be recovered. ```yaml Type: String -Parameter Sets: recoveryHostDatastoreCluster, recoveryHostDatastore +Parameter Sets: recoveryHostDatastore, recoveryHostDatastoreCluster Aliases: Required: True @@ -537,4 +537,4 @@ Vpg Settings Identifier ## RELATED LINKS -[Zerto REST API VPG Settings End Point Documentation](http://s3.amazonaws.com/zertodownload_docs/Latest/Zerto%20Virtual%20Replication%20Zerto%20Virtual%20Manager%20%28ZVM%29%20-%20vSphere%20Online%20Help/RestfulAPIs/StatusAPIs.5.108.html#) \ No newline at end of file +[Zerto REST API VPG Settings End Point Documentation](http://s3.amazonaws.com/zertodownload_docs/Latest/Zerto%20Virtual%20Replication%20Zerto%20Virtual%20Manager%20%28ZVM%29%20-%20vSphere%20Online%20Help/RestfulAPIs/StatusAPIs.5.108.html#) diff --git a/docs/New-ZertoVpgSettingsIdentifier.md b/docs/New-ZertoVpgSettingsIdentifier.md index f703f1b..8128a62 100644 --- a/docs/New-ZertoVpgSettingsIdentifier.md +++ b/docs/New-ZertoVpgSettingsIdentifier.md @@ -1,7 +1,7 @@ --- external help file: ZertoApiWrapper-help.xml Module Name: ZertoApiWrapper -online version: https://github.com/wcarroll/ZertoApiWrapper/blob/Master/docs/New-ZertoVpgSettingsIdentifier.md +online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/Master/docs/New-ZertoVpgSettingsIdentifier.md schema: 2.0.0 --- diff --git a/docs/Remove-ZertoPeerSite.md b/docs/Remove-ZertoPeerSite.md index 9475bdc..a42c84b 100644 --- a/docs/Remove-ZertoPeerSite.md +++ b/docs/Remove-ZertoPeerSite.md @@ -1,7 +1,7 @@ --- external help file: ZertoApiWrapper-help.xml Module Name: ZertoApiWrapper -online version: https://github.com/wcarroll/ZertoApiWrapper/blob/master/docs/Remove-ZertoPeerSite.md +online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Remove-ZertoPeerSite.md schema: 2.0.0 --- @@ -160,4 +160,4 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## RELATED LINKS -[Zerto REST API Peer Site End Point Documentation](http://s3.amazonaws.com/zertodownload_docs/Latest/Zerto%20Virtual%20Replication%20Zerto%20Virtual%20Manager%20%28ZVM%29%20-%20vSphere%20Online%20Help/index.html#page/RestfulAPIs%2FStatusAPIs.5.044.html%23) \ No newline at end of file +[Zerto REST API Peer Site End Point Documentation](http://s3.amazonaws.com/zertodownload_docs/Latest/Zerto%20Virtual%20Replication%20Zerto%20Virtual%20Manager%20%28ZVM%29%20-%20vSphere%20Online%20Help/index.html#page/RestfulAPIs%2FStatusAPIs.5.044.html%23) diff --git a/docs/Remove-ZertoVpg.md b/docs/Remove-ZertoVpg.md index 86ef8db..877e44e 100644 --- a/docs/Remove-ZertoVpg.md +++ b/docs/Remove-ZertoVpg.md @@ -1,7 +1,7 @@ --- external help file: ZertoApiWrapper-help.xml Module Name: ZertoApiWrapper -online version: https://github.com/wcarroll/ZertoApiWrapper/blob/master/docs/Remove-ZertoVpg.md +online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Remove-ZertoVpg.md schema: 2.0.0 --- @@ -21,7 +21,7 @@ Remove-ZertoVpg -vpgidentifier [-keepRecoveryVolumes] [-force] [-What ### vpgName ``` -Remove-ZertoVpg [-vpgName] [-keepRecoveryVolumes] [-force] [-WhatIf] [-Confirm] [] +Remove-ZertoVpg -vpgName [-keepRecoveryVolumes] [-force] [-WhatIf] [-Confirm] [] ``` ## DESCRIPTION @@ -122,7 +122,7 @@ Parameter Sets: vpgName Aliases: Required: True -Position: 0 +Position: Named Default value: None Accept pipeline input: True (ByPropertyName, ByValue) Accept wildcard characters: False diff --git a/docs/Remove-ZertoVpgSettingsIdentifier.md b/docs/Remove-ZertoVpgSettingsIdentifier.md new file mode 100644 index 0000000..17eb3c7 --- /dev/null +++ b/docs/Remove-ZertoVpgSettingsIdentifier.md @@ -0,0 +1,90 @@ +--- +external help file: ZertoApiWrapper-help.xml +Module Name: ZertoApiWrapper +online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Resume-ZertoVpgSettingsIdentifier.md +schema: 2.0.0 +--- + +# Remove-ZertoVpgSettingsIdentifier + +## SYNOPSIS +When a new VpgSettingsIdentifier is created, all the settings sit in memory for 30 minutes after the last change. This operation will delete the settings from memory and discard any changes. This is akin to clicking cancel on the VPG Edit Wizard screen. + +## SYNTAX + +``` +Remove-ZertoVpgSettingsIdentifier [-vpgSettingsIdentifier] [-WhatIf] [-Confirm] [] +``` + +## DESCRIPTION +When a new VpgSettingsIdentifier is created, all the settings sit in memory for 30 minutes after the last change. This operation will delete the settings from memory and discard any changes. This is akin to clicking cancel on the VPG Edit Wizard screen. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> Remove-ZertoVpgSettingsIdentifier -vpgSettingsIdentifier "1234-7890-5678" +``` + +Removes VPG Settings Identifier "1234-7890-5678" from the Zerto Virtual Manager without applying any settings that may have changed. + +## PARAMETERS + +### -vpgSettingsIdentifier +Settings Identifier to Remove + +```yaml +Type: String[] +Parameter Sets: (All) +Aliases: + +Required: True +Position: 1 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +## NOTES + +## RELATED LINKS + +[Zerto Rest API VPG Settings End Point Documentation](http://s3.amazonaws.com/zertodownload_docs/Latest/Zerto%20Virtual%20Replication%20Zerto%20Virtual%20Manager%20%28ZVM%29%20-%20vSphere%20Online%20Help/index.html#page/RestfulAPIs%2FStatusAPIs.5.118.html%23) diff --git a/docs/Remove-ZertoVpgVm.md b/docs/Remove-ZertoVpgVm.md new file mode 100644 index 0000000..624c3b4 --- /dev/null +++ b/docs/Remove-ZertoVpgVm.md @@ -0,0 +1,121 @@ +--- +external help file: ZertoApiWrapper-help.xml +Module Name: ZertoApiWrapper +online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Resume-ZertoVpgVm.md +schema: 2.0.0 +--- + +# Remove-ZertoVpgVm + +## SYNOPSIS +Removes one or more VMs from a specified VPG. A Task Identifier is returned to track progress. + +## SYNTAX + +``` +Remove-ZertoVpgVm -VpgName -Vm [-WhatIf] [-Confirm] [] +``` + +## DESCRIPTION +Removes one or more VMs from a specified VPG. A Task Identifier is returned to track progress. Internal logic will remove duplicate VM names from the list of VMs provided as well as ensure membership in the VPG specified prior to attempting to remove the VM from the VPG. Finally the VPG is saved to commit the changes. ChangeImpact is set to 'High' to get the confirmation prompt. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> Remove-ZertoVpgVm -VpgName 'My Vpg' -Vm 'Vm 1' +``` + +Removes 'Vm 1' from Vpg named 'My Vpg' + +### Example 2 +```powershell +PS C:\> Remove-ZertoVpgVm -VpgName 'My Vpg' -Vm 'Vm 1', 'Vm 2' +``` + +Removes 'Vm 1' and 'Vm 2' from Vpg named 'My Vpg'. + +### Example 3 +```powershell +PS C:\> Remove-ZertoVpgVm -VpgName 'My Vpg' -Vm 'Vm 1', 'Vm 2' -Confirm:$False +``` + +Removes 'Vm 1' and 'Vm 2' from Vpg named 'My Vpg' and bypasses the confirmation prompt + +## PARAMETERS + +### -Vm +Name of VM(s) to remove from the VPG + +```yaml +Type: String[] +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -VpgName +Name of the VPG that contains the VM you wish to remove + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### None + +## OUTPUTS + +### System.Object +## NOTES + +## RELATED LINKS +[Remove Vms from a VPG Settings Object](https://s3.amazonaws.com/zertodownload_docs/Latest/Zerto%20Virtual%20Replication%20Zerto%20Virtual%20Manager%20(ZVM)%20-%20vSphere%20Online%20Help/content/zvr_apis/vpg_management_api.htm?tocpath=ZVR%20RESTful%20APIs%7CZerto%20APIs%7C_____20#statusapis_4057192544_1361409) diff --git a/docs/Resume-ZertoVpg.md b/docs/Resume-ZertoVpg.md index 93e9f43..6e52056 100644 --- a/docs/Resume-ZertoVpg.md +++ b/docs/Resume-ZertoVpg.md @@ -1,7 +1,7 @@ --- external help file: ZertoApiWrapper-help.xml Module Name: ZertoApiWrapper -online version: https://github.com/wcarroll/ZertoApiWrapper/blob/master/docs/Resume-ZertoVpg.md +online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Resume-ZertoVpg.md schema: 2.0.0 --- diff --git a/docs/Save-ZertoVpgSetting.md b/docs/Save-ZertoVpgSetting.md index b0305e1..4604408 100644 --- a/docs/Save-ZertoVpgSetting.md +++ b/docs/Save-ZertoVpgSetting.md @@ -1,7 +1,7 @@ --- external help file: ZertoApiWrapper-help.xml Module Name: ZertoApiWrapper -online version: https://github.com/wcarroll/ZertoApiWrapper/blob/master/docs/Save-ZertoVpgSetting.md +online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Save-ZertoVpgSetting.md schema: 2.0.0 --- @@ -36,10 +36,10 @@ VpgSettings Identifier to save ```yaml Type: String Parameter Sets: (All) -Aliases: vpgSettingsId +Aliases: sid, settingsIdentifier, vpgSettingsId Required: True -Position: 1 +Position: 0 Default value: None Accept pipeline input: True (ByPropertyName, ByValue) Accept wildcard characters: False diff --git a/docs/Set-ZertoAlert.md b/docs/Set-ZertoAlert.md index 9a7cd65..5ceb8ba 100644 --- a/docs/Set-ZertoAlert.md +++ b/docs/Set-ZertoAlert.md @@ -1,7 +1,7 @@ --- external help file: ZertoApiWrapper-help.xml Module Name: ZertoApiWrapper -online version: https://github.com/wcarroll/ZertoApiWrapper/blob/master/docs/Set-ZertoAlert.md +online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Set-ZertoAlert.md schema: 2.0.0 --- diff --git a/docs/Set-ZertoLicense.md b/docs/Set-ZertoLicense.md index a604a13..a353532 100644 --- a/docs/Set-ZertoLicense.md +++ b/docs/Set-ZertoLicense.md @@ -1,7 +1,7 @@ --- external help file: ZertoApiWrapper-help.xml Module Name: ZertoApiWrapper -online version: https://github.com/wcarroll/ZertoApiWrapper/blob/master/docs/Set-ZertoLicense.md +online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Set-ZertoLicense.md schema: 2.0.0 --- diff --git a/docs/Set-ZertoUserCredential.md b/docs/Set-ZertoUserCredential.md new file mode 100644 index 0000000..9fd7d20 --- /dev/null +++ b/docs/Set-ZertoUserCredential.md @@ -0,0 +1,97 @@ +--- +external help file: ZertoApiWrapper-help.xml +Module Name: ZertoApiWrapper +online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Set-ZertoUserCredential.md +schema: 2.0.0 +--- + +# Set-ZertoUserCredential + +## SYNOPSIS +Allows the change or update of the credentials used to allow the Zerto Virtual Manager to connect and communicate with the paired Hypervisor. + +## SYNTAX + +``` +Set-ZertoUserCredential [-UserCredential] [-WhatIf] [-Confirm] [] +``` + +## DESCRIPTION +Allows the change or update of the credentials used to allow the Zerto Virtual Manager to connect and communicate with the paired Hypervisor. A PSCredential object is required and will be used to pass the updated credentials. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> Set-ZertoUserCredential -UserCredential $UserCredential +``` + +Will update the user account used to connect the Zerto Virtual Manager to the the paired Hypervisor. + +### Example 2 +```powershell +PS C:\> Set-ZertoUserCredential -UserCredential $UserCredential -Confirm:$False +``` + +Will update the user account used to connect the Zerto Virtual Manager to the the paired Hypervisor. CAUTION: By adding the `-Confirm:$False` parameter, this will suppress the confirmation dialog and you will not be prompted if you wish to complete this action. + +## PARAMETERS + +### -UserCredential +PSCredential Object that contains the username and password for the updated credentials. + +```yaml +Type: PSCredential +Parameter Sets: (All) +Aliases: + +Required: True +Position: 1 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. +For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +## NOTES + +## RELATED LINKS +[PSCredential Object Information](https://docs.microsoft.com/en-us/dotnet/api/system.management.automation.pscredential) diff --git a/docs/Start-ZertoCloneVpg.md b/docs/Start-ZertoCloneVpg.md index 6c0cedb..9ab204d 100644 --- a/docs/Start-ZertoCloneVpg.md +++ b/docs/Start-ZertoCloneVpg.md @@ -1,7 +1,7 @@ --- external help file: ZertoApiWrapper-help.xml Module Name: ZertoApiWrapper -online version: https://github.com/wcarroll/ZertoApiWrapper/blob/master/docs/Start-ZertoCloneVpg.md +online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Start-ZertoCloneVpg.md schema: 2.0.0 --- diff --git a/docs/Start-ZertoFailoverTest.md b/docs/Start-ZertoFailoverTest.md index 7899454..1299291 100644 --- a/docs/Start-ZertoFailoverTest.md +++ b/docs/Start-ZertoFailoverTest.md @@ -1,7 +1,7 @@ --- external help file: ZertoApiWrapper-help.xml Module Name: ZertoApiWrapper -online version: https://github.com/wcarroll/ZertoApiWrapper/blob/master/docs/Start-ZertoFailoverTest.md +online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Start-ZertoFailoverTest.md schema: 2.0.0 --- diff --git a/docs/Stop-ZertoCloneVpg.md b/docs/Stop-ZertoCloneVpg.md index 5e96bd7..2c28b8d 100644 --- a/docs/Stop-ZertoCloneVpg.md +++ b/docs/Stop-ZertoCloneVpg.md @@ -1,7 +1,7 @@ --- external help file: ZertoApiWrapper-help.xml Module Name: ZertoApiWrapper -online version: https://github.com/wcarroll/ZertoApiWrapper/blob/master/docs/Stop-ZertoCloneVpg.md +online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Stop-ZertoCloneVpg.md schema: 2.0.0 --- diff --git a/docs/Stop-ZertoFailoverTest.md b/docs/Stop-ZertoFailoverTest.md index f4ab758..5a52590 100644 --- a/docs/Stop-ZertoFailoverTest.md +++ b/docs/Stop-ZertoFailoverTest.md @@ -1,7 +1,7 @@ --- external help file: ZertoApiWrapper-help.xml Module Name: ZertoApiWrapper -online version: https://github.com/wcarroll/ZertoApiWrapper/blob/master/docs/Stop-ZertoFailoverTest.md +online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Stop-ZertoFailoverTest.md schema: 2.0.0 --- diff --git a/docs/Suspend-ZertoVpg.md b/docs/Suspend-ZertoVpg.md index d1336a2..466b6d7 100644 --- a/docs/Suspend-ZertoVpg.md +++ b/docs/Suspend-ZertoVpg.md @@ -1,7 +1,7 @@ --- external help file: ZertoApiWrapper-help.xml Module Name: ZertoApiWrapper -online version: https://github.com/wcarroll/ZertoApiWrapper/blob/master/docs/Suspend-ZertoVpg.md +online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Suspend-ZertoVpg.md schema: 2.0.0 --- diff --git a/docs/Uninstall-ZertoVra.md b/docs/Uninstall-ZertoVra.md index b19e8f1..cae5377 100644 --- a/docs/Uninstall-ZertoVra.md +++ b/docs/Uninstall-ZertoVra.md @@ -1,7 +1,7 @@ --- external help file: ZertoApiWrapper-help.xml Module Name: ZertoApiWrapper -online version: https://github.com/wcarroll/ZertoApiWrapper/blob/master/docs/Uninstall-ZertoVra.md +online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Uninstall-ZertoVra.md schema: 2.0.0 --- diff --git a/version.txt b/version.txt index 6e8bf73..8af85be 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -0.1.0 +1.5.3 From 7e61fbec7e1a32a4aab58cecabbec2753d071d26 Mon Sep 17 00:00:00 2001 From: Justin Paul Date: Fri, 25 Feb 2022 21:37:48 -0500 Subject: [PATCH 2/2] 1.5.4 updates Doc updates and help file updates to support numofcpu parameter in Install-ZertoVra function --- CHANGELOG.md | 8 ++++++++ docs/Install-ZertoVra.md | 16 ++++++++++++++++ version.txt | 2 +- 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1ff98e1..fc277be 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,14 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project is transitioning to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [1.5.4] + +### Zerto Virtual Manager + +#### Updated + +* Updated `Install-ZertoVra` function [help documentation](https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Install-ZertoVra.md) to allow for configuring the number of vCPUs during deployment. Special thanks to @mitchellen for the fix. + ## [1.5.3] ### Zerto Virtual Manager diff --git a/docs/Install-ZertoVra.md b/docs/Install-ZertoVra.md index b9b6136..a33e14a 100644 --- a/docs/Install-ZertoVra.md +++ b/docs/Install-ZertoVra.md @@ -165,6 +165,22 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -numofCPU +Initial number of vCPUs to assign to the VRA. +Default is 1, Minimum is 1, Maximum is 4 + +```yaml +Type: Int32 +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### -memoryInGB Initial amount of memory to assign to the VRA in GB. Default is 3, Minimum is 1, Maximum is 16 diff --git a/version.txt b/version.txt index 8af85be..94fe62c 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -1.5.3 +1.5.4