From 83650838143350d589b1163c1684952002808b5c Mon Sep 17 00:00:00 2001 From: Wes Carroll Date: Thu, 6 Jun 2019 10:32:00 -0400 Subject: [PATCH 01/37] Create CODE_OF_CONDUCT.md --- CODE_OF_CONDUCT.md | 76 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 CODE_OF_CONDUCT.md 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 From 79fe7de886fcbe7f0d76d75661a4b89962b3c246 Mon Sep 17 00:00:00 2001 From: Wes Carroll Date: Mon, 3 Jun 2019 07:11:15 -0400 Subject: [PATCH 02/37] Create Invoke-ZARestRequest.ps1 --- .../Private/Invoke-ZARestRequest.ps1 | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 ZertoApiWrapper/Private/Invoke-ZARestRequest.ps1 diff --git a/ZertoApiWrapper/Private/Invoke-ZARestRequest.ps1 b/ZertoApiWrapper/Private/Invoke-ZARestRequest.ps1 new file mode 100644 index 0000000..599bad8 --- /dev/null +++ b/ZertoApiWrapper/Private/Invoke-ZARestRequest.ps1 @@ -0,0 +1,20 @@ +function Invoke-ZARestRequest { + [cmdletbinding()] + param( + [string]$uri, + [string]$method = "GET", + [string]$body, + [string]$contentType = "application/json" + ) + + $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 { + 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 + } + } +} \ No newline at end of file From 6a32ed6e14d7a35c48c7df85f115230449d6303c Mon Sep 17 00:00:00 2001 From: Wes Carroll Date: Mon, 3 Jun 2019 07:11:20 -0400 Subject: [PATCH 03/37] Create Connect-ZertoAnalytics.ps1 --- .../Public/Connect-ZertoAnalytics.ps1 | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 ZertoApiWrapper/Public/Connect-ZertoAnalytics.ps1 diff --git a/ZertoApiWrapper/Public/Connect-ZertoAnalytics.ps1 b/ZertoApiWrapper/Public/Connect-ZertoAnalytics.ps1 new file mode 100644 index 0000000..698d957 --- /dev/null +++ b/ZertoApiWrapper/Public/Connect-ZertoAnalytics.ps1 @@ -0,0 +1,19 @@ +function Connect-ZertoAnalytics { + [cmdletbinding()] + param( + [Parameter( + Mandatory = $true, + 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 +} \ No newline at end of file From 183bbc7d1314ac6a7398139430f93eceb75fe43e Mon Sep 17 00:00:00 2001 From: Wes Carroll Date: Mon, 3 Jun 2019 07:11:33 -0400 Subject: [PATCH 04/37] Create Get-ZALicense.ps1 --- ZertoApiWrapper/Public/Get-ZALicense.ps1 | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 ZertoApiWrapper/Public/Get-ZALicense.ps1 diff --git a/ZertoApiWrapper/Public/Get-ZALicense.ps1 b/ZertoApiWrapper/Public/Get-ZALicense.ps1 new file mode 100644 index 0000000..02c8fd1 --- /dev/null +++ b/ZertoApiWrapper/Public/Get-ZALicense.ps1 @@ -0,0 +1,4 @@ +function Get-ZALicense { + $uri = "licenses" + Invoke-ZARestRequest -uri $uri +} \ No newline at end of file From 934f02664489bff524d3361c3d6d82996ccf6eea Mon Sep 17 00:00:00 2001 From: Wes Carroll Date: Wed, 5 Jun 2019 14:07:37 -0400 Subject: [PATCH 05/37] Add External Help File --- ZertoApiWrapper/Public/Connect-ZertoAnalytics.ps1 | 1 + 1 file changed, 1 insertion(+) diff --git a/ZertoApiWrapper/Public/Connect-ZertoAnalytics.ps1 b/ZertoApiWrapper/Public/Connect-ZertoAnalytics.ps1 index 698d957..2c8e95f 100644 --- a/ZertoApiWrapper/Public/Connect-ZertoAnalytics.ps1 +++ b/ZertoApiWrapper/Public/Connect-ZertoAnalytics.ps1 @@ -1,3 +1,4 @@ +<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #> function Connect-ZertoAnalytics { [cmdletbinding()] param( From ab39ba70a2144186a159a1412149726d7729f68a Mon Sep 17 00:00:00 2001 From: Wes Carroll Date: Wed, 5 Jun 2019 14:07:58 -0400 Subject: [PATCH 06/37] Create Invoke-ZARestRequest.Tests.ps1 --- Tests/Private/Invoke-ZARestRequest.Tests.ps1 | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 Tests/Private/Invoke-ZARestRequest.Tests.ps1 diff --git a/Tests/Private/Invoke-ZARestRequest.Tests.ps1 b/Tests/Private/Invoke-ZARestRequest.Tests.ps1 new file mode 100644 index 0000000..984d682 --- /dev/null +++ b/Tests/Private/Invoke-ZARestRequest.Tests.ps1 @@ -0,0 +1,17 @@ +$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 From c78ad3e696c93c0f5c30d54b6d37e2104a94185b Mon Sep 17 00:00:00 2001 From: Wes Carroll Date: Wed, 5 Jun 2019 14:08:06 -0400 Subject: [PATCH 07/37] Create Connect-ZertoAnalytics.Tests.ps1 --- Tests/Public/Connect-ZertoAnalytics.Tests.ps1 | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 Tests/Public/Connect-ZertoAnalytics.Tests.ps1 diff --git a/Tests/Public/Connect-ZertoAnalytics.Tests.ps1 b/Tests/Public/Connect-ZertoAnalytics.Tests.ps1 new file mode 100644 index 0000000..50d2f9d --- /dev/null +++ b/Tests/Public/Connect-ZertoAnalytics.Tests.ps1 @@ -0,0 +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 + +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 + } +} \ No newline at end of file From 5f24cc8c73c7508197e17d675e943943604d7515 Mon Sep 17 00:00:00 2001 From: Wes Carroll Date: Wed, 5 Jun 2019 14:08:45 -0400 Subject: [PATCH 08/37] Make into an advanced function. --- ZertoApiWrapper/Public/Get-ZALicense.ps1 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ZertoApiWrapper/Public/Get-ZALicense.ps1 b/ZertoApiWrapper/Public/Get-ZALicense.ps1 index 02c8fd1..bd1bd94 100644 --- a/ZertoApiWrapper/Public/Get-ZALicense.ps1 +++ b/ZertoApiWrapper/Public/Get-ZALicense.ps1 @@ -1,4 +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 From b4246057350b53270a3ffac0b751cbf5da5faaa1 Mon Sep 17 00:00:00 2001 From: Wes Carroll Date: Wed, 5 Jun 2019 14:12:36 -0400 Subject: [PATCH 09/37] Create Get-ZALicense.Tests.ps1 --- Tests/Public/Get-ZALicense.Tests.ps1 | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 Tests/Public/Get-ZALicense.Tests.ps1 diff --git a/Tests/Public/Get-ZALicense.Tests.ps1 b/Tests/Public/Get-ZALicense.Tests.ps1 new file mode 100644 index 0000000..50d2f9d --- /dev/null +++ b/Tests/Public/Get-ZALicense.Tests.ps1 @@ -0,0 +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 + +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 + } +} \ No newline at end of file From 848daf3c49f02a8192198501c480aab0a352e311 Mon Sep 17 00:00:00 2001 From: Wes Carroll Date: Wed, 5 Jun 2019 14:13:31 -0400 Subject: [PATCH 10/37] Create ZAMonitoring Function and Tests --- Tests/Public/Get-ZAMonitoring.Tests.ps1 | 19 +++++++++++++++++++ ZertoApiWrapper/Public/Get-ZAMonitoring.ps1 | 18 ++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 Tests/Public/Get-ZAMonitoring.Tests.ps1 create mode 100644 ZertoApiWrapper/Public/Get-ZAMonitoring.ps1 diff --git a/Tests/Public/Get-ZAMonitoring.Tests.ps1 b/Tests/Public/Get-ZAMonitoring.Tests.ps1 new file mode 100644 index 0000000..50d2f9d --- /dev/null +++ b/Tests/Public/Get-ZAMonitoring.Tests.ps1 @@ -0,0 +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 + +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 + } +} \ 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 From 15435c9261c4386d819ac6a7f7d83a424387957e Mon Sep 17 00:00:00 2001 From: Wes Carroll Date: Wed, 5 Jun 2019 14:16:43 -0400 Subject: [PATCH 11/37] Create Get-ZAAlert Function and Tests --- Tests/Public/Get-ZAAlert.Tests.ps1 | 19 +++++++++++++ ZertoApiWrapper/Public/Get-ZAAlert.ps1 | 38 ++++++++++++++++++++++++++ 2 files changed, 57 insertions(+) create mode 100644 Tests/Public/Get-ZAAlert.Tests.ps1 create mode 100644 ZertoApiWrapper/Public/Get-ZAAlert.ps1 diff --git a/Tests/Public/Get-ZAAlert.Tests.ps1 b/Tests/Public/Get-ZAAlert.Tests.ps1 new file mode 100644 index 0000000..f5816b6 --- /dev/null +++ b/Tests/Public/Get-ZAAlert.Tests.ps1 @@ -0,0 +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 + +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 + } +} diff --git a/ZertoApiWrapper/Public/Get-ZAAlert.ps1 b/ZertoApiWrapper/Public/Get-ZAAlert.ps1 new file mode 100644 index 0000000..f47ca3f --- /dev/null +++ b/ZertoApiWrapper/Public/Get-ZAAlert.ps1 @@ -0,0 +1,38 @@ +<# .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 VPG Idnetifier", + ParameterSetName = "vpgId" + )] + [ValidateNotNullOrEmpty()] + [string]$vpgIdentifier + ) + $uri = "monitoring/alerts" + switch ($PSCmdlet.ParameterSetName) { + zOrg { + if ( $PSBoundParameters.Keys.Count -gt 0 ) { + $filterString = Get-ZertoApiFilter -filterTable $PSBoundParameters + $uri = "{0}{1}" -f $uri, $filterString + } + } + + vpgId { + $uri = "{0}/{1}" -f $uri, $vpgIdentifier + } + } + Invoke-ZARestRequest -uri $uri +} From e43e911c7b177fcc4f7302bcb661ea41429ac291 Mon Sep 17 00:00:00 2001 From: Wes Carroll Date: Wed, 5 Jun 2019 14:17:41 -0400 Subject: [PATCH 12/37] Create Get-ZAAlertAggregation Function and Tests --- Tests/Public/Get-ZAAlertAggregation.Tests.ps1 | 19 ++++++++++++++++++ .../Public/Get-ZAAlertAggregation.ps1 | 20 +++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 Tests/Public/Get-ZAAlertAggregation.Tests.ps1 create mode 100644 ZertoApiWrapper/Public/Get-ZAAlertAggregation.ps1 diff --git a/Tests/Public/Get-ZAAlertAggregation.Tests.ps1 b/Tests/Public/Get-ZAAlertAggregation.Tests.ps1 new file mode 100644 index 0000000..f5816b6 --- /dev/null +++ b/Tests/Public/Get-ZAAlertAggregation.Tests.ps1 @@ -0,0 +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 + +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 + } +} diff --git a/ZertoApiWrapper/Public/Get-ZAAlertAggregation.ps1 b/ZertoApiWrapper/Public/Get-ZAAlertAggregation.ps1 new file mode 100644 index 0000000..7b82559 --- /dev/null +++ b/ZertoApiWrapper/Public/Get-ZAAlertAggregation.ps1 @@ -0,0 +1,20 @@ +<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #> +function Get-ZAAlertAggeration { + [cmdletbinding()] + param( + [Parameter( + HelpMessage = "The ZORG identifier by which to filter the alert count. If the ZORG identifier is omitted, retrieves all alerts sorted by entity and by type." + )] + [ValidateNotNullOrEmpty()] + [string]$zOrgIdentifier + ) + $uri = "monitoring/alerts" + if ( -not [String]::IsNullorEmpty($zOrgIdentifier) ) { + $filterTable = @{"zOrgIdentifier" = $zOrgIdentifier } + $filterString = Get-ZertoApiFilter -filterTable $filterTable + $uri = "{0}{1}&format=aggregations" -f $uri, $filterString + } else { + $uri = "{0}?format=aggregations" -f $uri + } + Invoke-ZARestRequest -uri $uri +} From 5018404641d22cec04c216b205251d9ccbcd64f7 Mon Sep 17 00:00:00 2001 From: Wes Carroll Date: Wed, 5 Jun 2019 14:18:16 -0400 Subject: [PATCH 13/37] Create Get-ZASite Function and Tests --- Tests/Public/Get-ZASite.Tests.ps1 | 19 +++++++++++++++++++ ZertoApiWrapper/Public/Get-ZASite.ps1 | 18 ++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 Tests/Public/Get-ZASite.Tests.ps1 create mode 100644 ZertoApiWrapper/Public/Get-ZASite.ps1 diff --git a/Tests/Public/Get-ZASite.Tests.ps1 b/Tests/Public/Get-ZASite.Tests.ps1 new file mode 100644 index 0000000..f5816b6 --- /dev/null +++ b/Tests/Public/Get-ZASite.Tests.ps1 @@ -0,0 +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 + +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 + } +} 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 +} From 97aa9f1ba80abd035c542df264d0365309345482 Mon Sep 17 00:00:00 2001 From: Wes Carroll Date: Wed, 5 Jun 2019 14:18:57 -0400 Subject: [PATCH 14/37] Create Get-ZASiteTopology Function and Tests --- Tests/Public/Get-ZASiteTopology.Tests.ps1 | 19 ++++++++++++++++++ ZertoApiWrapper/Public/Get-ZASiteTopology.ps1 | 20 +++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 Tests/Public/Get-ZASiteTopology.Tests.ps1 create mode 100644 ZertoApiWrapper/Public/Get-ZASiteTopology.ps1 diff --git a/Tests/Public/Get-ZASiteTopology.Tests.ps1 b/Tests/Public/Get-ZASiteTopology.Tests.ps1 new file mode 100644 index 0000000..f5816b6 --- /dev/null +++ b/Tests/Public/Get-ZASiteTopology.Tests.ps1 @@ -0,0 +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 + +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 + } +} 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 +} From 87857303a03adac5e3ae64fee3a3e1ef5ca5c334 Mon Sep 17 00:00:00 2001 From: Wes Carroll Date: Wed, 5 Jun 2019 14:19:34 -0400 Subject: [PATCH 15/37] Create Get-ZAVpg Function and Tests --- Tests/Public/Get-ZAVpg.Tests.ps1 | 19 +++++++++++++++ ZertoApiWrapper/Public/Get-ZAVpg.ps1 | 36 ++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 Tests/Public/Get-ZAVpg.Tests.ps1 create mode 100644 ZertoApiWrapper/Public/Get-ZAVpg.ps1 diff --git a/Tests/Public/Get-ZAVpg.Tests.ps1 b/Tests/Public/Get-ZAVpg.Tests.ps1 new file mode 100644 index 0000000..f5816b6 --- /dev/null +++ b/Tests/Public/Get-ZAVpg.Tests.ps1 @@ -0,0 +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 + +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 + } +} diff --git a/ZertoApiWrapper/Public/Get-ZAVpg.ps1 b/ZertoApiWrapper/Public/Get-ZAVpg.ps1 new file mode 100644 index 0000000..3b31e20 --- /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 = $true + )] + [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" + } + } + + Invoke-ZARestRequest -uri $uri +} From 8d5111a24a0e506cf4389370ef2ba0a6c4ae8746 Mon Sep 17 00:00:00 2001 From: Wes Carroll Date: Wed, 5 Jun 2019 14:20:13 -0400 Subject: [PATCH 16/37] Create Get-ZAzOrg Function and Tests --- Tests/Public/Get-ZAzOrg.Tests.ps1 | 19 +++++++++++++++++++ ZertoApiWrapper/Public/Get-ZAzOrg.ps1 | 7 +++++++ 2 files changed, 26 insertions(+) create mode 100644 Tests/Public/Get-ZAzOrg.Tests.ps1 create mode 100644 ZertoApiWrapper/Public/Get-ZAzOrg.ps1 diff --git a/Tests/Public/Get-ZAzOrg.Tests.ps1 b/Tests/Public/Get-ZAzOrg.Tests.ps1 new file mode 100644 index 0000000..f5816b6 --- /dev/null +++ b/Tests/Public/Get-ZAzOrg.Tests.ps1 @@ -0,0 +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 + +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 + } +} 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 From bc9e485346d2352cac1631c06c16a33df0cb7641 Mon Sep 17 00:00:00 2001 From: Wes Carroll Date: Wed, 5 Jun 2019 15:41:31 -0400 Subject: [PATCH 17/37] Update Invoke-ZertoFailoverCommit.md Add SupportShouldProcess --- docs/Invoke-ZertoFailoverCommit.md | 34 ++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/docs/Invoke-ZertoFailoverCommit.md b/docs/Invoke-ZertoFailoverCommit.md index 627ece1..b9d302f 100644 --- a/docs/Invoke-ZertoFailoverCommit.md +++ b/docs/Invoke-ZertoFailoverCommit.md @@ -13,7 +13,7 @@ Commit a running VPG failover ## SYNTAX ``` -Invoke-ZertoFailoverCommit [-vpgName] [-reverseProtection] [] +Invoke-ZertoFailoverCommit [-vpgName] [-reverseProtection] [-WhatIf] [-Confirm] [] ``` ## DESCRIPTION @@ -67,8 +67,38 @@ 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). +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 From 70261242db7497a6a37079f3dc8f2be9957df3b5 Mon Sep 17 00:00:00 2001 From: Wes Carroll Date: Wed, 5 Jun 2019 15:55:28 -0400 Subject: [PATCH 18/37] Update Invoke-ZertoFailoverCommit.md --- docs/Invoke-ZertoFailoverCommit.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/Invoke-ZertoFailoverCommit.md b/docs/Invoke-ZertoFailoverCommit.md index b9d302f..f7876b3 100644 --- a/docs/Invoke-ZertoFailoverCommit.md +++ b/docs/Invoke-ZertoFailoverCommit.md @@ -98,7 +98,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 From ba4f0fc82a399b4dd2615dc583803f2c9a14cd8c Mon Sep 17 00:00:00 2001 From: Wes Carroll Date: Thu, 6 Jun 2019 11:20:01 -0400 Subject: [PATCH 19/37] Create Connect-ZertoAnalytics.md --- docs/Connect-ZertoAnalytics.md | 60 ++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 docs/Connect-ZertoAnalytics.md diff --git a/docs/Connect-ZertoAnalytics.md b/docs/Connect-ZertoAnalytics.md new file mode 100644 index 0000000..86a10c7 --- /dev/null +++ b/docs/Connect-ZertoAnalytics.md @@ -0,0 +1,60 @@ +--- +external help file: ZertoApiWrapper-help.xml +Module Name: ZertoApiWrapper +online version: +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) From 8581c037d719812f9d6d47679765c9a49ac7de74 Mon Sep 17 00:00:00 2001 From: Wes Carroll Date: Thu, 6 Jun 2019 11:20:29 -0400 Subject: [PATCH 20/37] Add task to update the Markdown help files with new commands. --- ZertoApiWrapper.build.ps1 | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ZertoApiWrapper.build.ps1 b/ZertoApiWrapper.build.ps1 index 448cab0..69d0b3e 100644 --- a/ZertoApiWrapper.build.ps1 +++ b/ZertoApiWrapper.build.ps1 @@ -89,6 +89,12 @@ task UpdateMarkdownHelp CheckPlatyPSInstalled, { Update-MarkDownHelp -Path docs -AlphabeticParamsOrder } +task UpdateMarkdownHelpModule CheckPlatyPSInstalled, { + remove-module ZertoApiWrapper -force -ErrorAction SilentlyContinue + Import-Module .\ZertoApiWrapper\ZertoApiWrapper.psm1 -Force + Update-MarkDownHelpModule -Path docs -AlphabeticParamsOrder +} + task CreatePsd1ForRelease CleanTemp, { $functionsToExport = Get-ChildItem -Path 'ZertoApiWrapper\Public\*.ps1' | ForEach-Object { $_.BaseName } $releaseNotes = "# {0}{1}" -f $version, $(Get-Content .\RELEASENOTES.md -Raw) From 5990d57285bd69dd87b33bf2916d20960efb8667 Mon Sep 17 00:00:00 2001 From: Wes Carroll Date: Thu, 6 Jun 2019 11:31:44 -0400 Subject: [PATCH 21/37] Fix variable Typo --- ZertoApiWrapper/Public/Get-ZAAlert.ps1 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ZertoApiWrapper/Public/Get-ZAAlert.ps1 b/ZertoApiWrapper/Public/Get-ZAAlert.ps1 index f47ca3f..f2e4a2d 100644 --- a/ZertoApiWrapper/Public/Get-ZAAlert.ps1 +++ b/ZertoApiWrapper/Public/Get-ZAAlert.ps1 @@ -16,10 +16,10 @@ function Get-ZAAlert { [int]$limitTo, [Parameter( HelpMessage = "The VPG Idnetifier", - ParameterSetName = "vpgId" + ParameterSetName = "alertId" )] [ValidateNotNullOrEmpty()] - [string]$vpgIdentifier + [string]$alertIdentifier ) $uri = "monitoring/alerts" switch ($PSCmdlet.ParameterSetName) { @@ -30,8 +30,8 @@ function Get-ZAAlert { } } - vpgId { - $uri = "{0}/{1}" -f $uri, $vpgIdentifier + alertId { + $uri = "{0}/{1}" -f $uri, $alertIdentifier } } Invoke-ZARestRequest -uri $uri From d8084b2fb3a01e5c748e954b2797b53a46900d95 Mon Sep 17 00:00:00 2001 From: Wes Carroll Date: Thu, 6 Jun 2019 11:31:55 -0400 Subject: [PATCH 22/37] Formatting Update --- docs/Connect-ZertoAnalytics.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/Connect-ZertoAnalytics.md b/docs/Connect-ZertoAnalytics.md index 86a10c7..3d50e87 100644 --- a/docs/Connect-ZertoAnalytics.md +++ b/docs/Connect-ZertoAnalytics.md @@ -57,4 +57,5 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## NOTES ## RELATED LINKS + [Zerto Analytics REST API Endpoint for Authentication](https://docs.api.zerto.com/#/Authentication/post_v2_auth_token) From f0f45a383f40ff9efc2c88d0264d221013462a4d Mon Sep 17 00:00:00 2001 From: Wes Carroll Date: Thu, 6 Jun 2019 11:34:27 -0400 Subject: [PATCH 23/37] Create Get-ZAAlert Markdown Help File --- docs/Get-ZAAlert.md | 125 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 125 insertions(+) create mode 100644 docs/Get-ZAAlert.md diff --git a/docs/Get-ZAAlert.md b/docs/Get-ZAAlert.md new file mode 100644 index 0000000..abced20 --- /dev/null +++ b/docs/Get-ZAAlert.md @@ -0,0 +1,125 @@ +--- +external help file: ZertoApiWrapper-help.xml +Module Name: ZertoApiWrapper +online version: +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: False +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_) From 0fbc6d2242f2ea72fab38b78b653903e5362dbdb Mon Sep 17 00:00:00 2001 From: Wes Carroll Date: Thu, 6 Jun 2019 11:35:41 -0400 Subject: [PATCH 24/37] Create Get-ZALicense Markdown Help File --- docs/Get-ZALicense.md | 45 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 docs/Get-ZALicense.md diff --git a/docs/Get-ZALicense.md b/docs/Get-ZALicense.md new file mode 100644 index 0000000..27a9e9c --- /dev/null +++ b/docs/Get-ZALicense.md @@ -0,0 +1,45 @@ +--- +external help file: ZertoApiWrapper-help.xml +Module Name: ZertoApiWrapper +online version: +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) From 8b09b702d61781cdb64b0ab2ccbd5cda6045582b Mon Sep 17 00:00:00 2001 From: Wes Carroll Date: Thu, 6 Jun 2019 11:42:01 -0400 Subject: [PATCH 25/37] Create Get-ZAMonitoring Markdown Help file --- docs/Get-ZAMonitoring.md | 69 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 docs/Get-ZAMonitoring.md diff --git a/docs/Get-ZAMonitoring.md b/docs/Get-ZAMonitoring.md new file mode 100644 index 0000000..131adca --- /dev/null +++ b/docs/Get-ZAMonitoring.md @@ -0,0 +1,69 @@ +--- +external help file: ZertoApiWrapper-help.xml +Module Name: ZertoApiWrapper +online version: +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_) From 6d66a1c35b139910ee21fce225114adb402aaeaf Mon Sep 17 00:00:00 2001 From: Wes Carroll Date: Thu, 6 Jun 2019 11:44:04 -0400 Subject: [PATCH 26/37] Create Get-ZASite Markdown help file --- docs/Get-ZASite.md | 69 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 docs/Get-ZASite.md diff --git a/docs/Get-ZASite.md b/docs/Get-ZASite.md new file mode 100644 index 0000000..5bb6dbe --- /dev/null +++ b/docs/Get-ZASite.md @@ -0,0 +1,69 @@ +--- +external help file: ZertoApiWrapper-help.xml +Module Name: ZertoApiWrapper +online version: +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) From a3fd87f933fecf7c573811212acada3691a2d97f Mon Sep 17 00:00:00 2001 From: Wes Carroll Date: Thu, 6 Jun 2019 11:46:49 -0400 Subject: [PATCH 27/37] Create Get-ZASiteTopology Markdown Help File --- docs/Get-ZASiteTopology.md | 70 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 docs/Get-ZASiteTopology.md diff --git a/docs/Get-ZASiteTopology.md b/docs/Get-ZASiteTopology.md new file mode 100644 index 0000000..c6b5686 --- /dev/null +++ b/docs/Get-ZASiteTopology.md @@ -0,0 +1,70 @@ +--- +external help file: ZertoApiWrapper-help.xml +Module Name: ZertoApiWrapper +online version: +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) From ebc86c5e7164376521efaaad679f61aa5f607689 Mon Sep 17 00:00:00 2001 From: Wes Carroll Date: Thu, 6 Jun 2019 11:48:49 -0400 Subject: [PATCH 28/37] Update Function to set variable to mandatory --- ZertoApiWrapper/Public/Get-ZAAlert.ps1 | 3 ++- docs/Get-ZAAlert.md | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/ZertoApiWrapper/Public/Get-ZAAlert.ps1 b/ZertoApiWrapper/Public/Get-ZAAlert.ps1 index f2e4a2d..af0c80e 100644 --- a/ZertoApiWrapper/Public/Get-ZAAlert.ps1 +++ b/ZertoApiWrapper/Public/Get-ZAAlert.ps1 @@ -16,7 +16,8 @@ function Get-ZAAlert { [int]$limitTo, [Parameter( HelpMessage = "The VPG Idnetifier", - ParameterSetName = "alertId" + ParameterSetName = "alertId", + Mandatory = $true )] [ValidateNotNullOrEmpty()] [string]$alertIdentifier diff --git a/docs/Get-ZAAlert.md b/docs/Get-ZAAlert.md index abced20..2e98eaa 100644 --- a/docs/Get-ZAAlert.md +++ b/docs/Get-ZAAlert.md @@ -19,7 +19,7 @@ Get-ZAAlert [-zOrgIdentifier ] [-limitTo ] [] ### alertId ``` -Get-ZAAlert [-alertIdentifier ] [] +Get-ZAAlert -alertIdentifier [] ``` ## DESCRIPTION @@ -72,7 +72,7 @@ Type: String Parameter Sets: alertId Aliases: -Required: False +Required: True Position: Named Default value: None Accept pipeline input: False From cddd25ded1b5204b341319a985cdfa55e28fd858 Mon Sep 17 00:00:00 2001 From: Wes Carroll Date: Thu, 6 Jun 2019 11:49:49 -0400 Subject: [PATCH 29/37] Formatting Update --- docs/Get-ZAMonitoring.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/Get-ZAMonitoring.md b/docs/Get-ZAMonitoring.md index 131adca..7489568 100644 --- a/docs/Get-ZAMonitoring.md +++ b/docs/Get-ZAMonitoring.md @@ -9,7 +9,7 @@ schema: 2.0.0 ## SYNOPSIS -Retrieve statistics related to all the user’s sites - belonging to a single account. +Retrieve statistics related to all the user's sites - belonging to a single account. ## SYNTAX @@ -19,7 +19,7 @@ Get-ZAMonitoring [[-zOrgIdentifier] ] [] ## DESCRIPTION -Retrieve statistics related to all the user’s sites - belonging to a single account. +Retrieve statistics related to all the user's sites - belonging to a single account. ## EXAMPLES @@ -28,7 +28,7 @@ Retrieve statistics related to all the user’s sites - belonging to a single ac PS C:\> Get-ZAMonitoring ``` -Retrieve statistics related to all the user’s sites - belonging to a single account. +Retrieve statistics related to all the user's sites - belonging to a single account. ### Example 1 ```powershell From 9799feaeea545f2568cac8eeef69771020103ffe Mon Sep 17 00:00:00 2001 From: Wes Carroll Date: Thu, 6 Jun 2019 11:50:09 -0400 Subject: [PATCH 30/37] Formatting Update --- docs/Get-ZASiteTopology.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/Get-ZASiteTopology.md b/docs/Get-ZASiteTopology.md index c6b5686..cb42853 100644 --- a/docs/Get-ZASiteTopology.md +++ b/docs/Get-ZASiteTopology.md @@ -9,7 +9,7 @@ schema: 2.0.0 ## 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). +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 @@ -19,7 +19,7 @@ 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: +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 @@ -29,14 +29,14 @@ The information might not be complete, since there are sites that do not transmi PS C:\> Get-ZASiteTopology ``` -Retrieves a collection of Sites topology information structures for all the available user’s sites. +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". +Retrieves a collection of Sites topology information structures for all the available user's sites within zOrgIdentifier "1234-5678-9012". ## PARAMETERS From 2c891795b2fcb664fac60bee7c9dcc011bcee0ec Mon Sep 17 00:00:00 2001 From: Wes Carroll Date: Thu, 6 Jun 2019 11:57:05 -0400 Subject: [PATCH 31/37] Add Online Parameter URL --- docs/Connect-ZertoAnalytics.md | 2 +- docs/Get-ZAAlert.md | 2 +- docs/Get-ZALicense.md | 2 +- docs/Get-ZAMonitoring.md | 2 +- docs/Get-ZASite.md | 2 +- docs/Get-ZASiteTopology.md | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/Connect-ZertoAnalytics.md b/docs/Connect-ZertoAnalytics.md index 3d50e87..4b789bf 100644 --- a/docs/Connect-ZertoAnalytics.md +++ b/docs/Connect-ZertoAnalytics.md @@ -1,7 +1,7 @@ --- external help file: ZertoApiWrapper-help.xml Module Name: ZertoApiWrapper -online version: +online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Connect-ZertoAnalytics.md schema: 2.0.0 --- diff --git a/docs/Get-ZAAlert.md b/docs/Get-ZAAlert.md index 2e98eaa..3ef258f 100644 --- a/docs/Get-ZAAlert.md +++ b/docs/Get-ZAAlert.md @@ -1,7 +1,7 @@ --- external help file: ZertoApiWrapper-help.xml Module Name: ZertoApiWrapper -online version: +online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZAAlert.md schema: 2.0.0 --- diff --git a/docs/Get-ZALicense.md b/docs/Get-ZALicense.md index 27a9e9c..cc9b992 100644 --- a/docs/Get-ZALicense.md +++ b/docs/Get-ZALicense.md @@ -1,7 +1,7 @@ --- external help file: ZertoApiWrapper-help.xml Module Name: ZertoApiWrapper -online version: +online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZALicense.md schema: 2.0.0 --- diff --git a/docs/Get-ZAMonitoring.md b/docs/Get-ZAMonitoring.md index 7489568..da04a32 100644 --- a/docs/Get-ZAMonitoring.md +++ b/docs/Get-ZAMonitoring.md @@ -1,7 +1,7 @@ --- external help file: ZertoApiWrapper-help.xml Module Name: ZertoApiWrapper -online version: +online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZAMonitoring.md schema: 2.0.0 --- diff --git a/docs/Get-ZASite.md b/docs/Get-ZASite.md index 5bb6dbe..4af04a2 100644 --- a/docs/Get-ZASite.md +++ b/docs/Get-ZASite.md @@ -1,7 +1,7 @@ --- external help file: ZertoApiWrapper-help.xml Module Name: ZertoApiWrapper -online version: +online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZASite.md schema: 2.0.0 --- diff --git a/docs/Get-ZASiteTopology.md b/docs/Get-ZASiteTopology.md index cb42853..cd75b6d 100644 --- a/docs/Get-ZASiteTopology.md +++ b/docs/Get-ZASiteTopology.md @@ -1,7 +1,7 @@ --- external help file: ZertoApiWrapper-help.xml Module Name: ZertoApiWrapper -online version: +online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZASiteTopology.md schema: 2.0.0 --- From f2d2e00f12db2f6595bdbdf90fb31dbe09bace28 Mon Sep 17 00:00:00 2001 From: Wes Carroll Date: Thu, 6 Jun 2019 12:28:07 -0400 Subject: [PATCH 32/37] Create Get-ZAVpg External Help File --- docs/Get-ZAVpg.md | 98 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100644 docs/Get-ZAVpg.md diff --git a/docs/Get-ZAVpg.md b/docs/Get-ZAVpg.md new file mode 100644 index 0000000..07ff413 --- /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_) From 7ec6d846c0ba2e896ceb236a186f700cf0ff7f84 Mon Sep 17 00:00:00 2001 From: Wes Carroll Date: Thu, 6 Jun 2019 12:30:01 -0400 Subject: [PATCH 33/37] Create External Help File for Get-ZAzOrg Function --- docs/Get-ZAzOrg.md | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 docs/Get-ZAzOrg.md diff --git a/docs/Get-ZAzOrg.md b/docs/Get-ZAzOrg.md new file mode 100644 index 0000000..4fe4457 --- /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) From 4fc6c9ebcd7c2007a17ca9108a89e732bd1605c2 Mon Sep 17 00:00:00 2001 From: Wes Carroll Date: Thu, 6 Jun 2019 13:36:04 -0400 Subject: [PATCH 34/37] Create Get-ZAEvent Files --- Tests/Public/Get-ZAEvent.Tests.ps1 | 19 ++++ ZertoApiWrapper/Public/Get-ZAEvent.ps1 | 39 +++++++ docs/Get-ZAEvent.md | 140 +++++++++++++++++++++++++ 3 files changed, 198 insertions(+) create mode 100644 Tests/Public/Get-ZAEvent.Tests.ps1 create mode 100644 ZertoApiWrapper/Public/Get-ZAEvent.ps1 create mode 100644 docs/Get-ZAEvent.md diff --git a/Tests/Public/Get-ZAEvent.Tests.ps1 b/Tests/Public/Get-ZAEvent.Tests.ps1 new file mode 100644 index 0000000..f5816b6 --- /dev/null +++ b/Tests/Public/Get-ZAEvent.Tests.ps1 @@ -0,0 +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 + +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 + } +} 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/docs/Get-ZAEvent.md b/docs/Get-ZAEvent.md new file mode 100644 index 0000000..dbfa390 --- /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) From 0e148bdb1b2314d1bd64ce6b4f6a503d94f97411 Mon Sep 17 00:00:00 2001 From: Wes Carroll Date: Thu, 6 Jun 2019 13:59:13 -0400 Subject: [PATCH 35/37] Create Get-ZATask files and content --- Tests/Public/Get-ZATask.Tests.ps1 | 19 +++++ ZertoApiWrapper/Public/Get-ZATask.ps1 | 39 +++++++++ docs/Get-ZATask.md | 112 ++++++++++++++++++++++++++ 3 files changed, 170 insertions(+) create mode 100644 Tests/Public/Get-ZATask.Tests.ps1 create mode 100644 ZertoApiWrapper/Public/Get-ZATask.ps1 create mode 100644 docs/Get-ZATask.md diff --git a/Tests/Public/Get-ZATask.Tests.ps1 b/Tests/Public/Get-ZATask.Tests.ps1 new file mode 100644 index 0000000..f5816b6 --- /dev/null +++ b/Tests/Public/Get-ZATask.Tests.ps1 @@ -0,0 +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 + +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 + } +} diff --git a/ZertoApiWrapper/Public/Get-ZATask.ps1 b/ZertoApiWrapper/Public/Get-ZATask.ps1 new file mode 100644 index 0000000..2f1bce5 --- /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 = $true + )] + [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/docs/Get-ZATask.md b/docs/Get-ZATask.md new file mode 100644 index 0000000..bb5f3bf --- /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) From c88d175fd0da6e359c2ecdab22fd9f01d5b78021 Mon Sep 17 00:00:00 2001 From: Wes Carroll Date: Thu, 6 Jun 2019 13:59:41 -0400 Subject: [PATCH 36/37] Correct Help Message Typo --- ZertoApiWrapper/Public/Get-ZAAlert.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ZertoApiWrapper/Public/Get-ZAAlert.ps1 b/ZertoApiWrapper/Public/Get-ZAAlert.ps1 index af0c80e..1026895 100644 --- a/ZertoApiWrapper/Public/Get-ZAAlert.ps1 +++ b/ZertoApiWrapper/Public/Get-ZAAlert.ps1 @@ -15,7 +15,7 @@ function Get-ZAAlert { [ValidateRange(1, 1000000)] [int]$limitTo, [Parameter( - HelpMessage = "The VPG Idnetifier", + HelpMessage = "The alert Idnetifier", ParameterSetName = "alertId", Mandatory = $true )] From 1f03feb1c68b909269b3b3b5e584dee6d86c27b8 Mon Sep 17 00:00:00 2001 From: Wes Carroll Date: Thu, 6 Jun 2019 14:29:22 -0400 Subject: [PATCH 37/37] Create Get-ZADatastore function & supporting docs --- Tests/Public/Get-ZADatastore.Tests.ps1 | 19 ++++ ZertoApiWrapper/Public/Get-ZADatastore.ps1 | 37 +++++++ docs/Get-ZADatastore.md | 123 +++++++++++++++++++++ 3 files changed, 179 insertions(+) create mode 100644 Tests/Public/Get-ZADatastore.Tests.ps1 create mode 100644 ZertoApiWrapper/Public/Get-ZADatastore.ps1 create mode 100644 docs/Get-ZADatastore.md diff --git a/Tests/Public/Get-ZADatastore.Tests.ps1 b/Tests/Public/Get-ZADatastore.Tests.ps1 new file mode 100644 index 0000000..f5816b6 --- /dev/null +++ b/Tests/Public/Get-ZADatastore.Tests.ps1 @@ -0,0 +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 + +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 + } +} diff --git a/ZertoApiWrapper/Public/Get-ZADatastore.ps1 b/ZertoApiWrapper/Public/Get-ZADatastore.ps1 new file mode 100644 index 0000000..64bb34f --- /dev/null +++ b/ZertoApiWrapper/Public/Get-ZADatastore.ps1 @@ -0,0 +1,37 @@ +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 = $true, + ParameterSetName = "AllInfo" + )] + [Parameter( + Mandatory = $true, + ParameterSetName = "cluster" + )] + [Parameter( + Mandatory = $true, + ParameterSetName = "datastore" + )] + [ValidateNotNullOrEmpty()] + [string]$siteIdentifier, + [Parameter( + HelpMessage = "The datastore cluster identifier. Gets a list of datastores in the cluster.", + ParameterSetName = "cluster", + Mandatory = "true" + )] + [ValidateNotNullOrEmpty()] + [string]$clusterIdentifier, + [Parameter( + HelpMessage = "The datastore identifer. Gets the datastore info.", + ParameterSetName = "datastore", + Mandatory = $true + )] + [string]$datastoreIdentifier + + ) + $filter = Get-ZertoApiFilter -filterTable $PSBoundParameters + $uri = "monitoring/datastores{0}" -f $filter + Invoke-ZARestRequest -uri $uri +} diff --git a/docs/Get-ZADatastore.md b/docs/Get-ZADatastore.md new file mode 100644 index 0000000..b44e4f4 --- /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)