diff --git a/DattoAPI/DattoAPI.psd1 b/DattoAPI/DattoAPI.psd1 index b4e940a..880ef87 100644 Binary files a/DattoAPI/DattoAPI.psd1 and b/DattoAPI/DattoAPI.psd1 differ diff --git a/DattoAPI/Private/apiCalls/ConvertTo-DattoQueryString.ps1 b/DattoAPI/Private/apiCalls/ConvertTo-DattoQueryString.ps1 index 54a0057..57689a3 100644 --- a/DattoAPI/Private/apiCalls/ConvertTo-DattoQueryString.ps1 +++ b/DattoAPI/Private/apiCalls/ConvertTo-DattoQueryString.ps1 @@ -64,7 +64,7 @@ param( 'allPages', 'page', 'perPage', 'endpoint_Agents', 'endpoint_Devices', 'endpoint_byDevice', 'endpoint_byDeviceAgent', 'endpoint_byDeviceAlert', 'endpoint_byDeviceAsset', 'endpoint_byDeviceShare', 'endpoint_byDeviceVolume', - 'endpoint_Domains', 'endpoint_CustomerSeats', 'endpoint_CustomerApps', 'saasCustomerId' + 'endpoint_Domains', 'endpoint_CustomerSeats', 'endpoint_CustomerApps', 'saasCustomerId','externalSubscriptionId' $query_Parameters = [System.Web.HttpUtility]::ParseQueryString([String]::Empty) diff --git a/DattoAPI/Public/BCDR/Get-DattoVMRestore.ps1 b/DattoAPI/Public/BCDR/Get-DattoVMRestore.ps1 new file mode 100644 index 0000000..619db5a --- /dev/null +++ b/DattoAPI/Public/BCDR/Get-DattoVMRestore.ps1 @@ -0,0 +1,50 @@ +function Get-DattoVMRestore { +<# + .SYNOPSIS + Gets Datto BCDR VM restores by serial number + + .DESCRIPTION + The Get-DattoVMRestore cmdlet gets device VM restores + by serial number + + .PARAMETER serialNumber + Defines the BCDR serial number to get + + .EXAMPLE + Get-DattoVMRestore -serialNumber 12345 + + Gest Datto VM restores from the defined device + + .NOTES + N\A + + .LINK + https://celerium.github.io/Datto-PowerShellWrapper/site/BCDR/Get-DattoVMRestore.html +#> + + [CmdletBinding(DefaultParameterSetName = 'index')] + Param ( + [Parameter(Mandatory = $true, ValueFromPipeline = $true, ParameterSetName = 'index')] + [ValidateNotNullOrEmpty()] + [string]$serialNumber + ) + + begin { + + $resource_uri = "/bcdr/device/$serialNumber/vm-restores" + + } + + process { + + Write-Verbose "Running the [ $($PSCmdlet.ParameterSetName) ] parameterSet" + + Set-Variable -Name 'Datto_VMRestoreParameters' -Value $PSBoundParameters -Scope Global -Force + + Invoke-DattoRequest -method GET -resource_Uri $resource_Uri -uri_Filter $PSBoundParameters + + } + + end {} + +} diff --git a/DattoAPI/Public/SaaS/Get-DattoBulkSeatAssignment.ps1 b/DattoAPI/Public/SaaS/Get-DattoBulkSeatAssignment.ps1 new file mode 100644 index 0000000..2ecde88 --- /dev/null +++ b/DattoAPI/Public/SaaS/Get-DattoBulkSeatAssignment.ps1 @@ -0,0 +1,57 @@ +function Get-DattoBulkSeatAssignment { +<# + .SYNOPSIS + Get SaaS Protection bulk seats assignment + + .DESCRIPTION + The Get-DattoBulkSeatAssignment cmdlet get SaaS Protection + bulk seats assignment + + .PARAMETER saasCustomerId + Defines the id of the customer to get SaaS information from + + .PARAMETER externalSubscriptionId + Defines the external Subscription Id of the customer to + get SaaS bulk seat information from + + .EXAMPLE + Get-DattoBulkSeatAssignment -saasCustomerId "12345678" -externalSubscriptionId 'ab23-bdf234-1234-asdf' + + Gets the Datto SaaS protection seats from the define customer id + + .NOTES + N\A + + .LINK + https://celerium.github.io/Datto-PowerShellWrapper/site/SaaS/Get-DattoBulkSeatAssignment.html +#> + + [CmdletBinding(DefaultParameterSetName = 'index')] + Param ( + [Parameter(Mandatory = $true, ValueFromPipeline = $true, ParameterSetName = 'index')] + [ValidateNotNullOrEmpty()] + [string]$saasCustomerId, + + [Parameter(Mandatory = $true, ParameterSetName = 'index')] + [ValidateNotNullOrEmpty()] + [string]$externalSubscriptionId + ) + + begin { + + $resource_uri = "/saas/$saasCustomerId/$externalSubscriptionId/bulkSeatAssignment" + + } + + process { + + Write-Verbose "Running the [ $($PSCmdlet.ParameterSetName) ] parameterSet" + + Set-Variable -Name 'Datto_bulkSeatParameters' -Value $PSBoundParameters -Scope Global -Force + + Invoke-DattoRequest -method GET -resource_Uri $resource_Uri -uri_Filter $PSBoundParameters + + } + + end {} +} diff --git a/build/DattoAPI/2.2.0/DattoAPI.psd1 b/build/DattoAPI/2.2.0/DattoAPI.psd1 new file mode 100644 index 0000000..ca3605b --- /dev/null +++ b/build/DattoAPI/2.2.0/DattoAPI.psd1 @@ -0,0 +1,136 @@ +# +# Module manifest for module 'DattoAPI' +# +# Generated by: David Schulte +# +# Generated on: 2022-04-23 +# + +@{ + + # Script module or binary module file associated with this manifest + RootModule = 'DattoAPI.psm1' + + # Version number of this module. + # Follows https://semver.org Semantic Versioning 2.0.0 + # Given a version number MAJOR.MINOR.PATCH, increment the: + # -- MAJOR version when you make incompatible API changes, + # -- MINOR version when you add functionality in a backwards-compatible manner, and + # -- PATCH version when you make backwards-compatible bug fixes. + + # Version number of this module. + ModuleVersion = '2.2.0' + + # Supported PSEditions + # CompatiblePSEditions = @() + + # ID used to uniquely identify this module + GUID = 'd536355d-2a81-444f-9e08-9eeeda6db819' + + # Author of this module + Author = 'David Schulte' + + # Company or vendor of this module + CompanyName = 'Celerium' + + # Copyright information of this module + Copyright = 'https://github.com/Celerium/Datto-PowerShellWrapper/blob/main/LICENSE' + + # Description of the functionality provided by this module + Description = 'This module provides a PowerShell wrapper for the Datto BCDR & SaaS API.' + + # Minimum version of the Windows PowerShell engine required by this module + PowerShellVersion = '5.1' + + # Name of the Windows PowerShell host required by this module + # PowerShellHostName = '' + + # Minimum version of the Windows PowerShell host required by this module + # PowerShellHostVersion = '' + + # Minimum version of Microsoft .NET Framework required by this module. This prerequisite is valid for the PowerShell Desktop edition only. + # DotNetFrameworkVersion = '' + + # Minimum version of the common language runtime (CLR) required by this module. This prerequisite is valid for the PowerShell Desktop edition only. + # CLRVersion = '' + + # Processor architecture (None, X86, Amd64) required by this module + # ProcessorArchitecture = '' + + # Modules that must be imported into the global environment prior to importing this module + # RequiredModules = @( ) + + # Assemblies that must be loaded prior to importing this module + # RequiredAssemblies = @() + + # Script files (.ps1) that are run in the caller's environment prior to importing this module. + #ScriptsToProcess = @() + + # Type files (.ps1xml) to be loaded when importing this module + # TypesToProcess = @() + + # Format files (.ps1xml) to be loaded when importing this module + # FormatsToProcess = @() + + # Modules to import as nested modules of the module specified in RootModule/ModuleToProcess + # 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 = @('ConvertTo-DattoQueryString','Get-DattoMetaData','Invoke-DattoRequest','Add-DattoAPIKey','Get-DattoAPIKey','Remove-DattoAPIKey','Test-DattoAPIKey','Add-DattoBaseURI','Get-DattoBaseURI','Remove-DattoBaseURI','Export-DattoModuleSettings','Get-DattoModuleSettings','Import-DattoModuleSettings','Initialize-DattoModuleSettings','Remove-DattoModuleSettings','Get-DattoAgent','Get-DattoAlert','Get-DattoAsset','Get-DattoBCDR','Get-DattoDevice','Get-DattoShare','Get-DattoVMRestore','Get-DattoVolume','Get-DattoActivityLog','Get-DattoApplication','Get-DattoBulkSeatAssignment','Get-DattoDomain','Get-DattoSaaS','Get-DattoSeat') + + # 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 = @() + + # Variables to export from this module + VariablesToExport = '*' + + # Aliases 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 aliases to export. + AliasesToExport = @('Set-DattoAPIKey','Set-DattoBaseURI') + + # DSC resources to export from this module + # DscResourcesToExport = @() + + # List of all modules packaged with this module + # ModuleList = @() + + # List of all files packaged with this module + # FileList = @() + + # Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell. + PrivateData = @{ + + PSData = @{ + + # Tags applied to this module. These help with module discovery in online galleries. + Tags = @('Datto', 'BCDR', 'SaaS', 'API', 'PowerShell', 'PSEdition_Desktop', 'PSEdition_Core', 'Windows', 'Kaseya', 'Celerium') + + # A URL to the license for this module. + LicenseUri = 'https://github.com/Celerium/Datto-PowerShellWrapper/blob/main/LICENSE' + + # A URL to the main website for this project. + ProjectUri = 'https://github.com/Celerium/Datto-PowerShellWrapper' + + # A URL to an icon representing this module. + IconUri = 'https://raw.githubusercontent.com/Celerium/Datto-PowerShellWrapper/main/.github/images/Celerium_PoSHGallery_DattoAPI.png' + + # ReleaseNotes of this module + ReleaseNotes = 'https://github.com/Celerium/Datto-PowerShellWrapper/blob/main/README.md' + + # Identifies the module as a prerelease version in online galleries. + #PreRelease = '-BETA' + + # Indicate whether the module requires explicit user acceptance for install, update, or save. + RequireLicenseAcceptance = $false + + } # End of PSData hashtable + + } # End of PrivateData hashtable + + # HelpInfo URI of this module + # HelpInfoURI = 'https://github.com/Celerium/Datto-PowerShellWrapper' + + # Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix. + # DefaultCommandPrefix = '' + +} + diff --git a/build/DattoAPI/2.2.0/DattoAPI.psm1 b/build/DattoAPI/2.2.0/DattoAPI.psm1 new file mode 100644 index 0000000..f5bf43c --- /dev/null +++ b/build/DattoAPI/2.2.0/DattoAPI.psm1 @@ -0,0 +1,2604 @@ +#Region '.\Private\apiCalls\ConvertTo-DattoQueryString.ps1' 0 +function ConvertTo-DattoQueryString { +<# + .SYNOPSIS + Converts uri filter parameters + + .DESCRIPTION + The Invoke-DattoRequest cmdlet converts & formats uri filter parameters + from a function which are later used to make the full resource uri for + an API call + + This is an internal helper function the ties in directly with the + Invoke-DattoRequest & any public functions that define parameters + + .PARAMETER uri_Filter + Hashtable of values to combine a functions parameters with + the resource_Uri parameter. + + This allows for the full uri query to occur + + .PARAMETER resource_Uri + Defines the short resource uri (url) to use when creating the API call + + .EXAMPLE + ConvertTo-DattoQueryString -uri_Filter $uri_Filter -resource_Uri '/account' + + Example: (From public function) + $uri_Filter = @{} + + ForEach ( $Key in $PSBoundParameters.GetEnumerator() ){ + if( $excludedParameters -contains $Key.Key ){$null} + else{ $uri_Filter += @{ $Key.Key = $Key.Value } } + } + + 1x key = https://api.datto.com/v1/account?accountId=12345 + 2x key = https://api.datto.com/v1/account?accountId=12345&details=True + + .NOTES + N\A + + .LINK + https://celerium.github.io/Datto-PowerShellWrapper/site/Internal/ConvertTo-DattoQueryString.html + +#> + +[CmdletBinding()] +param( + [Parameter(Mandatory = $true, ValueFromPipeline = $true)] + [hashtable]$uri_Filter, + + [Parameter(Mandatory = $true)] + [String]$resource_Uri +) + + begin {} + + process { + + if (-not $uri_Filter) { + return "" + } + + $excludedParameters = 'Debug', 'ErrorAction', 'ErrorVariable', 'InformationAction', 'InformationVariable', + 'OutBuffer', 'OutVariable', 'PipelineVariable', 'Verbose', 'WarningAction', 'WarningVariable', + 'allPages', 'page', 'perPage', + 'endpoint_Agents', 'endpoint_Devices', 'endpoint_byDevice', 'endpoint_byDeviceAgent', + 'endpoint_byDeviceAlert', 'endpoint_byDeviceAsset', 'endpoint_byDeviceShare', 'endpoint_byDeviceVolume', + 'endpoint_Domains', 'endpoint_CustomerSeats', 'endpoint_CustomerApps', 'saasCustomerId','externalSubscriptionId' + + $query_Parameters = [System.Web.HttpUtility]::ParseQueryString([String]::Empty) + + ForEach ( $Key in $uri_Filter.GetEnumerator() ){ + + if( $excludedParameters -contains $Key.Key ){$null} + elseif ( $Key.Value.GetType().IsArray ){ + Write-Verbose "[ $($Key.Key) ] is an array parameter" + foreach ($Value in $Key.Value) { + #$ParameterName = $Key.Key + $query_Parameters.Add($Key.Key, $Value) + } + } + else{ + $query_Parameters.Add($Key.Key, $Key.Value) + } + + } + + # Build the request and load it with the query string. + $uri_Request = [System.UriBuilder]($Datto_Base_URI + $resource_Uri) + $uri_Request.Query = $query_Parameters.ToString() + + return $uri_Request + + } + + end {} + +} +#EndRegion '.\Private\apiCalls\ConvertTo-DattoQueryString.ps1' 98 +#Region '.\Private\apiCalls\Get-DattoMetaData.ps1' 0 +function Get-DattoMetaData { +<# + .SYNOPSIS + Gets various Api metadata values + + .DESCRIPTION + The Get-DattoMetaData cmdlet gets various Api metadata values from an + Invoke-WebRequest to assist in various troubleshooting scenarios such + as rate-limiting. + + .PARAMETER base_uri + Define the base URI for the Datto API connection using Datto's URI or a custom URI. + + The default base URI is https://api.datto.com/v1 + + .EXAMPLE + Get-DattoMetaData + + Gets various Api metadata values from an Invoke-WebRequest to assist + in various troubleshooting scenarios such as rate-limiting. + + The default full base uri test path is: + https://api.datto.com/v1 + + .EXAMPLE + Get-DattoMetaData -base_uri http://myapi.gateway.example.com + + Gets various Api metadata values from an Invoke-WebRequest to assist + in various troubleshooting scenarios such as rate-limiting. + + The full base uri test path in this example is: + http://myapi.gateway.example.com/device + + .NOTES + N\A + + .LINK + https://celerium.github.io/Datto-PowerShellWrapper/site/Internal/Get-DattoMetaData.html +#> + + [CmdletBinding()] + Param ( + [parameter(Mandatory = $false, ValueFromPipeline = $true)] + [string]$base_uri = $Datto_Base_URI + ) + + begin { $resource_uri = "/bcdr/agent" } + + process { + + try { + + $Api_Token = Get-DattoAPIKey -plainText + $Api_Token_base64 = [Convert]::ToBase64String( [Text.Encoding]::ASCII.GetBytes( ("{0}:{1}" -f ($Api_Token).PublicKey,($Api_Token).SecretKey) ) ) + + $Datto_Headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]" + $Datto_Headers.Add("Content-Type", 'application/json') + $Datto_Headers.Add('Authorization', 'Basic {0}'-f $Api_Token_base64) + + $rest_output = Invoke-WebRequest -method Get -uri ($base_uri + $resource_uri) -headers $Datto_Headers -ErrorAction Stop + } + catch { + + [PSCustomObject]@{ + Method = $_.Exception.Response.Method + StatusCode = $_.Exception.Response.StatusCode.value__ + StatusDescription = $_.Exception.Response.StatusDescription + Message = $_.Exception.Message + URI = $($Datto_Base_URI + $resource_uri) + } + + } + finally { + Remove-Variable -Name Datto_Headers -Force + } + + if ($rest_output){ + $data = @{} + $data = $rest_output + + [PSCustomObject]@{ + ResponseUri = $data.BaseResponse.ResponseUri.AbsoluteUri + ResponsePort = $data.BaseResponse.ResponseUri.Port + StatusCode = $data.StatusCode + StatusDescription = $data.StatusDescription + 'Content-Type' = $data.headers.'Content-Type' + 'X-Request-Id' = $data.headers.'X-Request-Id' + 'X-API-Limit-Remaining' = $data.headers.'X-API-Limit-Remaining' + 'X-API-Limit-Resets' = $data.headers.'X-API-Limit-Resets' + 'X-API-Limit-Cost' = $data.headers.'X-API-Limit-Cost' + raw = $data + } + } + + } + + end {} +} +#EndRegion '.\Private\apiCalls\Get-DattoMetaData.ps1' 99 +#Region '.\Private\apiCalls\Invoke-DattoRequest.ps1' 0 +function Invoke-DattoRequest { +<# + .SYNOPSIS + Makes an API request + + .DESCRIPTION + The Invoke-DattoRequest cmdlet invokes an API request to Datto API. + + This is an internal function that is used by all public functions + + As of 2023-08 the Datto v1 API only supports GET requests + + .PARAMETER method + Defines the type of API method to use + + Allowed values: + 'GET' + + .PARAMETER resource_Uri + Defines the resource uri (url) to use when creating the API call + + .PARAMETER uri_Filter + Used with the internal function [ ConvertTo-DattoQueryString ] to combine + a functions parameters with the resource_Uri parameter. + + This allows for the full uri query to occur + + The full resource path is made with the following data + $Datto_Base_URI + $resource_Uri + ConvertTo-DattoQueryString + + .PARAMETER data + Place holder parameter to use when other methods are supported + by the Datto v1 API + + .PARAMETER allPages + Returns all items from an endpoint + + When using this parameter there is no need to use either the page or perPage + parameters + + .EXAMPLE + Invoke-DattoRequest -method GET -resource_Uri '/account' -uri_Filter $uri_Filter + + Invoke a rest method against the defined resource using any of the provided parameters + + Example: + Name Value + ---- ----- + Method GET + Uri https://api.datto.com/v1/account?accountId=12345&details=True + Headers {Authorization = Bearer 123456789} + Body + + + .NOTES + N\A + + .LINK + https://celerium.github.io/Datto-PowerShellWrapper/site/Internal/Invoke-DattoRequest.html + +#> + + [CmdletBinding()] + param ( + [Parameter(Mandatory = $false)] + [ValidateSet('GET')] + [String]$method = 'GET', + + [Parameter(Mandatory = $true)] + [String]$resource_Uri, + + [Parameter(Mandatory = $false)] + [Hashtable]$uri_Filter = $null, + + [Parameter(Mandatory = $false)] + [Hashtable]$data = $null, + + [Parameter(Mandatory = $false)] + [Switch]$allPages + + ) + + begin {} + + process { + + # Load Web assembly when needed as PowerShell Core has the assembly preloaded + if ( !("System.Web.HttpUtility" -as [Type]) ) { + Add-Type -Assembly System.Web + } + + $query_string = ConvertTo-DattoQueryString -uri_Filter $uri_Filter -resource_Uri $resource_Uri + + Set-Variable -Name 'Datto_queryString' -Value $query_string -Scope Global -Force + + if ($null -eq $data) { + $body = $null + } else { + $body = @{'data'= $data} | ConvertTo-Json -Depth $Datto_JSON_Conversion_Depth + } + + try { + $Api_Token = Get-DattoAPIKey -PlainText + $Api_Token_base64 = [Convert]::ToBase64String( [Text.Encoding]::ASCII.GetBytes( ("{0}:{1}" -f ($Api_Token).PublicKey,($Api_Token).SecretKey) ) ) + + $parameters = [ordered] @{ + "Method" = $method + "Uri" = $query_string.Uri + "Headers" = @{ 'Authorization' = 'Basic {0}'-f $Api_Token_base64; 'Content-Type' = 'application/json' } + "Body" = $body + } + Set-Variable -Name 'Datto_invokeParameters' -Value $parameters -Scope Global -Force + + if ($allPages){ + + Write-Verbose "Gathering all items from [ $( $Datto_Base_URI + $resource_Uri ) ] " + + $page_number = 1 + $all_responseData = [System.Collections.Generic.List[object]]::new() + + do { + + $parameters['Uri'] = $query_string.Uri -replace '_page=\d+',"_page=$page_number" + + $current_page = Invoke-RestMethod @parameters -ErrorAction Stop + + Write-Verbose "[ $page_number ] of [ $($current_page.pagination.totalPages) ] pages" + + foreach ($item in $current_page.items){ + $all_responseData.add($item) + } + + $page_number++ + + } while ($current_page.pagination.totalPages -ne $page_number - 1 -and $current_page.pagination.totalPages -ne 0) + + } + else{ + $api_response = Invoke-RestMethod @parameters -ErrorAction Stop + } + + } + catch { + + $exceptionError = $_.Exception.Message + Write-Warning 'The [ Datto_invokeParameters, Datto_queryString, & Datto_CmdletNameParameters ] variables can provide extra details' + + switch -Wildcard ($exceptionError) { + '*404*' { Write-Error "Invoke-DattoRequest : [ $resource_Uri ] not found!" } + '*429*' { Write-Error 'Invoke-DattoRequest : API rate limited' } + '*504*' { Write-Error "Invoke-DattoRequest : Gateway Timeout" } + default { Write-Error $_ } + } + + } + finally { + [void] ( $Datto_invokeParameters.Remove('Authorization') ) + } + + + if($allPages){ + + #Making output consistent + if( [string]::IsNullOrEmpty($all_responseData.data) ){ + $api_response = $null + } + else{ + $api_response = [PSCustomObject]@{ + data = $all_responseData + } + } + + return $api_response + + } + else{ return $api_response } + + } + + end {} + +} +#EndRegion '.\Private\apiCalls\Invoke-DattoRequest.ps1' 183 +#Region '.\Private\apiKeys\Add-DattoAPIKey.ps1' 0 +function Add-DattoAPIKey { +<# + .SYNOPSIS + Sets the API public & secret keys used to authenticate API calls. + + .DESCRIPTION + The Add-DattoAPIKey cmdlet sets the API public & secret keys which are used to + authenticate all API calls made to Datto. + + Once the API public & secret keys are defined, the secret key is encrypted using SecureString. + + The Datto API public & secret keys are generated via the Datto portal at Admin > Integrations + + .PARAMETER Api_Key_Public + Defines your API public key. + + .PARAMETER Api_Key_Secret + Defines your API secret key. + + .EXAMPLE + Add-DattoAPIKey + + Prompts to enter in the API public key and secret key. + + .EXAMPLE + Add-DattoAPIKey -Api_Key_Public '12345' + + The Datto API will use the string entered into the [ -Api_Key_Public ] parameter as the + public key & will then prompt to enter in the secret key. + + .EXAMPLE + '12345' | Add-DattoAPIKey + + The Datto API will use the string entered as the secret key & will prompt to enter in the public key. + + .NOTES + N\A + + .LINK + https://celerium.github.io/Datto-PowerShellWrapper/site/Internal/Add-DattoAPIKey.html +#> + + [cmdletbinding()] + Param ( + [Parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [string]$Api_Key_Public, + + [Parameter(Mandatory = $false, ValueFromPipeline = $true)] + [ValidateNotNullOrEmpty()] + [string]$Api_Key_Secret + ) + + begin {} + + process { + + if ($Api_Key_Secret) { + $x_api_key = ConvertTo-SecureString $Api_Key_Secret -AsPlainText -Force + + Set-Variable -Name "Datto_Public_Key" -Value $Api_Key_Public -Option ReadOnly -Scope global -Force + Set-Variable -Name "Datto_Secret_Key" -Value $x_api_key -Option ReadOnly -Scope global -Force + } + else { + $x_api_key = Read-Host -Prompt 'Please enter your API key' -AsSecureString + + Set-Variable -Name "Datto_Public_Key" -Value $Api_Key_Public -Option ReadOnly -Scope global -Force + Set-Variable -Name "Datto_Secret_Key" -Value $x_api_key -Option ReadOnly -Scope global -Force + } + + } + + end {} +} + +New-Alias -Name Set-DattoAPIKey -Value Add-DattoAPIKey -Force +#EndRegion '.\Private\apiKeys\Add-DattoAPIKey.ps1' 77 +#Region '.\Private\apiKeys\Get-DattoAPIKey.ps1' 0 +function Get-DattoAPIKey { +<# + .SYNOPSIS + Gets the Datto API public & secret key global variables. + + .DESCRIPTION + The Get-DattoAPIKey cmdlet gets the Datto API public & secret key + global variables and returns them as an object. + + .PARAMETER plainText + Decrypt and return the API key in plain text. + + .EXAMPLE + Get-DattoAPIKey + + Gets the Datto API public & secret key global variables and returns them as an object + with the secret key as a SecureString. + + .EXAMPLE + Get-DattoAPIKey -plainText + + Gets the Datto API public & secret key global variables and returns them as an object + with the secret key as plain text. + + + .NOTES + N\A + + .LINK + https://celerium.github.io/Datto-PowerShellWrapper/site/Internal/Get-DattoAPIKey.html +#> + + [cmdletbinding()] + Param ( + [Parameter(Mandatory = $false)] + [Switch]$plainText + ) + + begin {} + + process { + + try { + + if ($Datto_Secret_Key){ + + if ($plainText){ + $Api_Key = [System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($Datto_Secret_Key) + + [PSCustomObject]@{ + PublicKey = $Datto_Public_Key + SecretKey = ( [System.Runtime.InteropServices.Marshal]::PtrToStringAuto($Api_Key) ).ToString() + } + } + else { + [PSCustomObject]@{ + PublicKey = $Datto_Public_Key + SecretKey = $Datto_Secret_Key + } + } + + } + else { Write-Warning "The Datto API [ secret ] key is not set. Run Add-DattoAPIKey to set the API key." } + + } + catch { + Write-Error $_ + } + finally { + if ($Api_Key) { + [System.Runtime.InteropServices.Marshal]::ZeroFreeBSTR($Api_Key) + } + } + + + } + + end {} + +} +#EndRegion '.\Private\apiKeys\Get-DattoAPIKey.ps1' 81 +#Region '.\Private\apiKeys\Remove-DattoAPIKey.ps1' 0 +function Remove-DattoAPIKey { +<# + .SYNOPSIS + Removes the Datto API public & secret key global variables. + + .DESCRIPTION + The Remove-DattoAPIKey cmdlet removes the Datto API public & secret key global variables. + + .EXAMPLE + Remove-DattoAPIKey + + Removes the Datto API public & secret key global variables. + + .NOTES + N\A + + .LINK + https://celerium.github.io/Datto-PowerShellWrapper/site/Internal/Remove-DattoAPIKey.html +#> + + [cmdletbinding(SupportsShouldProcess)] + Param () + + begin {} + + process { + + switch ([bool]$Datto_Public_Key) { + $true { Remove-Variable -Name "Datto_Public_Key" -Scope global -Force } + $false { Write-Warning "The Datto API [ public ] key is not set. Nothing to remove" } + } + + switch ([bool]$Datto_Secret_Key) { + $true { Remove-Variable -Name "Datto_Secret_Key" -Scope global -Force } + $false { Write-Warning "The Datto API [ secret ] key is not set. Nothing to remove" } + } + + } + + end {} + +} +#EndRegion '.\Private\apiKeys\Remove-DattoAPIKey.ps1' 43 +#Region '.\Private\apiKeys\Test-DattoAPIKey.ps1' 0 +function Test-DattoAPIKey { +<# + .SYNOPSIS + Test the Datto API public & secret keys. + + .DESCRIPTION + The Test-DattoAPIKey cmdlet tests the base URI & API public & secret keys that were defined in the + Add-DattoBaseURI & Add-DattoAPIKey cmdlets. + + .PARAMETER base_uri + Define the base URI for the Datto API connection using Datto's URI or a custom URI. + + The default base URI is https://api.datto.com/v1/bcdr + + .EXAMPLE + Test-DattoBaseURI + + Tests the base URI & API access token that was defined in the + Add-DattoBaseURI & Add-DattoAPIKey cmdlets. + + The default full base uri test path is: + https://api.datto.com/v1/bcdr/device + + .EXAMPLE + Test-DattoBaseURI -base_uri http://myapi.gateway.example.com + + Tests the base URI & API access token that was defined in the + Add-DattoBaseURI & Add-DattoAPIKey cmdlets. + + The full base uri test path in this example is: + http://myapi.gateway.example.com/device + + .NOTES + N\A + + .LINK + https://celerium.github.io/Datto-PowerShellWrapper/site/Internal/Test-DattoAPIKey.html +#> + + [cmdletbinding()] + Param ( + [parameter(ValueFromPipeline = $true)] + [string]$base_uri = $Datto_Base_URI + ) + + begin { $resource_uri = "/bcdr/agent" } + + process { + + try { + + $Api_Token = Get-DattoAPIKey -plainText + $Api_Token_base64 = [Convert]::ToBase64String( [Text.Encoding]::ASCII.GetBytes( ("{0}:{1}" -f ($Api_Token).PublicKey,($Api_Token).SecretKey) ) ) + + $Datto_Headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]" + $Datto_Headers.Add("Content-Type", 'application/json') + $Datto_Headers.Add('Authorization', 'Basic {0}'-f $Api_Token_base64) + + $rest_output = Invoke-WebRequest -method Get -uri ($base_uri + $resource_uri) -headers $Datto_Headers -ErrorAction Stop + } + catch { + + [PSCustomObject]@{ + Method = $_.Exception.Response.Method + StatusCode = $_.Exception.Response.StatusCode.value__ + StatusDescription = $_.Exception.Response.StatusDescription + Message = $_.Exception.Message + URI = $($Datto_Base_URI + $resource_uri) + } + + } + finally { + Remove-Variable -Name Datto_Headers -Force + } + + if ($rest_output){ + $data = @{} + $data = $rest_output + + [PSCustomObject]@{ + StatusCode = $data.StatusCode + StatusDescription = $data.StatusDescription + URI = $($Datto_Base_URI + $resource_uri) + } + } + + } + + end {} + +} +#EndRegion '.\Private\apiKeys\Test-DattoAPIKey.ps1' 92 +#Region '.\Private\baseUri\Add-DattoBaseURI.ps1' 0 +function Add-DattoBaseURI { +<# + .SYNOPSIS + Sets the base URI for the Datto API connection. + + .DESCRIPTION + The Add-DattoBaseURI cmdlet sets the base URI which is later used + to construct the full URI for all API calls. + + .PARAMETER base_uri + Define the base URI for the Datto API connection using Datto's URI or a custom URI. + + .PARAMETER data_center + Datto's URI connection point that can be one of the predefined data centers. + + The accepted values for this parameter are: + [ US ] + US = https://api.datto.com/v1 + + Placeholder for other data centers. + + .EXAMPLE + Add-DattoBaseURI + + The base URI will use https://api.datto.com/v1 which is Datto's default URI. + + .EXAMPLE + Add-DattoBaseURI -data_center US + + The base URI will use https://api.datto.com/v1 which is Datto's US URI. + + .EXAMPLE + Add-DattoBaseURI -base_uri http://myapi.gateway.example.com + + A custom API gateway of http://myapi.gateway.example.com will be used for all API calls to Datto's API. + + .NOTES + N\A + + .LINK + https://celerium.github.io/Datto-PowerShellWrapper/site/Internal/Add-DattoBaseURI.html +#> + + [cmdletbinding()] + Param ( + [Parameter(Mandatory = $false , ValueFromPipeline = $true)] + [string]$base_uri = 'https://api.datto.com/v1', + + [ValidateSet( 'US' )] + [String]$data_center + ) + + begin {} + + process { + + # Trim superfluous forward slash from address (if applicable) + if ($base_uri[$base_uri.Length-1] -eq "/") { + $base_uri = $base_uri.Substring(0,$base_uri.Length-1) + } + + switch ($data_center) { + 'US' { $base_uri = 'https://api.datto.com/v1' } + } + + Set-Variable -Name "Datto_Base_URI" -Value $base_uri -Option ReadOnly -Scope global -Force + + } + + end {} + +} + +New-Alias -Name Set-DattoBaseURI -Value Add-DattoBaseURI +#EndRegion '.\Private\baseUri\Add-DattoBaseURI.ps1' 75 +#Region '.\Private\baseUri\Get-DattoBaseURI.ps1' 0 +function Get-DattoBaseURI { +<# + .SYNOPSIS + Shows the Datto base URI global variable. + + .DESCRIPTION + The Get-DattoBaseURI cmdlet shows the Datto base URI global variable value. + + .EXAMPLE + Get-DattoBaseURI + + Shows the Datto base URI global variable value. + + .NOTES + N\A + + .LINK + https://celerium.github.io/Datto-PowerShellWrapper/site/Internal/Get-DattoBaseURI.html +#> + + [cmdletbinding()] + Param () + + begin {} + + process { + + switch ([bool]$Datto_Base_URI) { + $true { $Datto_Base_URI } + $false { Write-Warning "The Datto base URI is not set. Run Add-DattoBaseURI to set the base URI." } + } + + } + + end {} + +} +#EndRegion '.\Private\baseUri\Get-DattoBaseURI.ps1' 38 +#Region '.\Private\baseUri\Remove-DattoBaseURI.ps1' 0 +function Remove-DattoBaseURI { +<# + .SYNOPSIS + Removes the Datto base URI global variable. + + .DESCRIPTION + The Remove-DattoBaseURI cmdlet removes the Datto base URI global variable. + + .EXAMPLE + Remove-DattoBaseURI + + Removes the Datto base URI global variable. + + .NOTES + N\A + + .LINK + https://celerium.github.io/Datto-PowerShellWrapper/site/Internal/Remove-DattoBaseURI.html +#> + + [cmdletbinding(SupportsShouldProcess)] + Param () + + begin {} + + process { + + switch ([bool]$Datto_Base_URI) { + $true { Remove-Variable -Name "Datto_Base_URI" -Scope global -Force } + $false { Write-Warning "The Datto base URI variable is not set. Nothing to remove" } + } + + } + + end {} + +} +#EndRegion '.\Private\baseUri\Remove-DattoBaseURI.ps1' 38 +#Region '.\Private\moduleSettings\Export-DattoModuleSettings.ps1' 0 +function Export-DattoModuleSettings { +<# + .SYNOPSIS + Exports the Datto BaseURI, API, & JSON configuration information to file. + + .DESCRIPTION + The Export-DattoModuleSettings cmdlet exports the Datto BaseURI, API, & JSON configuration information to file. + + Making use of PowerShell's System.Security.SecureString type, exporting module settings encrypts your API key in a format + that can only be unencrypted with the your Windows account as this encryption is tied to your user principal. + This means that you cannot copy your configuration file to another computer or user account and expect it to work. + + .PARAMETER dattoConfPath + Define the location to store the Datto configuration file. + + By default the configuration file is stored in the following location: + $env:USERPROFILE\DattoAPI + + .PARAMETER dattoConfFile + Define the name of the Datto configuration file. + + By default the configuration file is named: + config.psd1 + + .EXAMPLE + Export-DattoModuleSettings + + Validates that the BaseURI, API, and JSON depth are set then exports their values + to the current user's Datto configuration file located at: + $env:USERPROFILE\DattoAPI\config.psd1 + + .EXAMPLE + Export-DattoModuleSettings -DattoConfPath C:\DattoAPI -DattoConfFile MyConfig.psd1 + + Validates that the BaseURI, API, and JSON depth are set then exports their values + to the current user's Datto configuration file located at: + C:\DattoAPI\MyConfig.psd1 + + .NOTES + N\A + + .LINK + https://celerium.github.io/Datto-PowerShellWrapper/site/Internal/Export-DattoModuleSettings.html +#> + + [CmdletBinding(DefaultParameterSetName = 'set')] + Param ( + [Parameter(ParameterSetName = 'set')] + [string]$dattoConfPath = $(Join-Path -Path $home -ChildPath $(if ($IsWindows -or $PSEdition -eq 'Desktop'){"DattoAPI"}else{".DattoAPI"}) ), + + [Parameter(ParameterSetName = 'set')] + [string]$dattoConfFile = 'config.psd1' + ) + + begin {} + + process { + + Write-Warning "Secrets are stored using Windows Data Protection API (DPAPI)" + Write-Warning "DPAPI provides user context encryption in Windows but NOT in other operating systems like Linux or UNIX. It is recommended to use a more secure & cross-platform storage method" + + $dattoConfig = Join-Path -Path $dattoConfPath -ChildPath $dattoConfFile + + # Confirm variables exist and are not null before exporting + if ($Datto_Base_URI -and $Datto_Public_Key -and $Datto_Secret_Key -and $Datto_JSON_Conversion_Depth) { + $secureString = $Datto_Secret_Key | ConvertFrom-SecureString + + if ($IsWindows -or $PSEdition -eq 'Desktop') { + New-Item -Path $dattoConfPath -ItemType Directory -Force | ForEach-Object { $_.Attributes = $_.Attributes -bor "Hidden" } + } + else{ + New-Item -Path $dattoConfPath -ItemType Directory -Force + } +@" + @{ + Datto_Base_URI = '$Datto_Base_URI' + Datto_Public_Key = '$Datto_Public_Key' + Datto_Secret_Key = '$secureString' + Datto_JSON_Conversion_Depth = '$Datto_JSON_Conversion_Depth' + } +"@ | Out-File -FilePath $dattoConfig -Force + } + else { + Write-Error "Failed to export Datto Module settings to [ $dattoConfig ]" + Write-Error $_ + exit 1 + } + + } + + end {} + +} +#EndRegion '.\Private\moduleSettings\Export-DattoModuleSettings.ps1' 94 +#Region '.\Private\moduleSettings\Get-DattoModuleSettings.ps1' 0 +function Get-DattoModuleSettings { +<# + .SYNOPSIS + Gets the saved Datto configuration settings + + .DESCRIPTION + The Get-DattoModuleSettings cmdlet gets the saved Datto configuration settings + from the local system. + + By default the configuration file is stored in the following location: + $env:USERPROFILE\DattoAPI + + .PARAMETER dattoConfPath + Define the location to store the Datto configuration file. + + By default the configuration file is stored in the following location: + $env:USERPROFILE\DattoAPI + + .PARAMETER dattoConfFile + Define the name of the Datto configuration file. + + By default the configuration file is named: + config.psd1 + + .PARAMETER openConfFile + Opens the Datto configuration file + + .EXAMPLE + Get-DattoModuleSettings + + Gets the contents of the configuration file that was created with the + Export-DattoModuleSettings + + The default location of the Datto configuration file is: + $env:USERPROFILE\DattoAPI\config.psd1 + + .EXAMPLE + Get-DattoModuleSettings -DattoConfPath C:\DattoAPI -DattoConfFile MyConfig.psd1 -openConfFile + + Opens the configuration file from the defined location in the default editor + + The location of the Datto configuration file in this example is: + C:\DattoAPI\MyConfig.psd1 + + .NOTES + N\A + + .LINK + https://celerium.github.io/Datto-PowerShellWrapper/site/Internal/Get-DattoModuleSettings.html +#> + + [CmdletBinding(DefaultParameterSetName = 'index')] + Param ( + [Parameter(Mandatory = $false, ParameterSetName = 'index')] + [string]$dattoConfPath = $(Join-Path -Path $home -ChildPath $(if ($IsWindows -or $PSEdition -eq 'Desktop'){"DattoAPI"}else{".DattoAPI"}) ), + + [Parameter(Mandatory = $false, ParameterSetName = 'index')] + [String]$dattoConfFile = 'config.psd1', + + [Parameter(Mandatory = $false, ParameterSetName = 'show')] + [Switch]$openConfFile + ) + + begin { + $dattoConfig = Join-Path -Path $dattoConfPath -ChildPath $dattoConfFile + } + + process { + + if ( Test-Path -Path $dattoConfig ){ + + if($openConfFile){ + Invoke-Item -Path $dattoConfig + } + else{ + Import-LocalizedData -BaseDirectory $dattoConfPath -FileName $dattoConfFile + } + + } + else{ + Write-Verbose "No configuration file found at [ $dattoConfig ]" + } + + } + + end {} + +} +#EndRegion '.\Private\moduleSettings\Get-DattoModuleSettings.ps1' 89 +#Region '.\Private\moduleSettings\Import-DattoModuleSettings.ps1' 0 +function Import-DattoModuleSettings { +<# + .SYNOPSIS + Imports the Datto BaseURI, API, & JSON configuration information to the current session. + + .DESCRIPTION + The Import-DattoModuleSettings cmdlet imports the Datto BaseURI, API, & JSON configuration + information stored in the Datto configuration file to the users current session. + + By default the configuration file is stored in the following location: + $env:USERPROFILE\DattoAPI + + .PARAMETER dattoConfPath + Define the location to store the Datto configuration file. + + By default the configuration file is stored in the following location: + $env:USERPROFILE\DattoAPI + + .PARAMETER dattoConfFile + Define the name of the Datto configuration file. + + By default the configuration file is named: + config.psd1 + + .EXAMPLE + Import-DattoModuleSettings + + Validates that the configuration file created with the Export-DattoModuleSettings cmdlet exists + then imports the stored data into the current users session. + + The default location of the Datto configuration file is: + $env:USERPROFILE\DattoAPI\config.psd1 + + .EXAMPLE + Import-DattoModuleSettings -DattoConfPath C:\DattoAPI -DattoConfFile MyConfig.psd1 + + Validates that the configuration file created with the Export-DattoModuleSettings cmdlet exists + then imports the stored data into the current users session. + + The location of the Datto configuration file in this example is: + C:\DattoAPI\MyConfig.psd1 + + .NOTES + N\A + + .LINK + https://celerium.github.io/Datto-PowerShellWrapper/site/Internal/Import-DattoModuleSettings.html +#> + + [CmdletBinding(DefaultParameterSetName = 'set')] + Param ( + [Parameter(ParameterSetName = 'set')] + [string]$dattoConfPath = $(Join-Path -Path $home -ChildPath $(if ($IsWindows -or $PSEdition -eq 'Desktop'){"DattoAPI"}else{".DattoAPI"}) ), + + [Parameter(ParameterSetName = 'set')] + [string]$dattoConfFile = 'config.psd1' + ) + + begin { + $dattoConfig = Join-Path -Path $dattoConfPath -ChildPath $dattoConfFile + } + + process { + + if ( Test-Path $dattoConfig ) { + $tmp_config = Import-LocalizedData -BaseDirectory $dattoConfPath -FileName $dattoConfFile + + # Send to function to strip potentially superfluous slash (/) + Add-DattoBaseURI $tmp_config.Datto_Base_URI + + $tmp_config.Datto_Secret_Key = ConvertTo-SecureString $tmp_config.Datto_Secret_Key + + Set-Variable -Name "Datto_Public_Key" -Value $tmp_config.Datto_Public_key -Option ReadOnly -Scope global -Force + + Set-Variable -Name "Datto_Secret_Key" -Value $tmp_config.Datto_Secret_Key -Option ReadOnly -Scope global -Force + + Set-Variable -Name "Datto_JSON_Conversion_Depth" -Value $tmp_config.Datto_JSON_Conversion_Depth -Scope global -Force + + Write-Verbose "DattoAPI Module configuration loaded successfully from [ $dattoConfig ]" + + # Clean things up + Remove-Variable "tmp_config" + } + else { + Write-Verbose "No configuration file found at [ $dattoConfig ] run Add-DattoAPIKey to get started." + + Add-DattoBaseURI + + Set-Variable -Name "Datto_Base_URI" -Value $(Get-DattoBaseURI) -Option ReadOnly -Scope global -Force + Set-Variable -Name "Datto_JSON_Conversion_Depth" -Value 100 -Scope global -Force + } + + } + + end {} + +} +#EndRegion '.\Private\moduleSettings\Import-DattoModuleSettings.ps1' 98 +#Region '.\Private\moduleSettings\Initialize-DattoModuleSettings.ps1' 0 +#Used to auto load either baseline settings or saved configurations when the module is imported +Import-DattoModuleSettings -Verbose:$false +#EndRegion '.\Private\moduleSettings\Initialize-DattoModuleSettings.ps1' 3 +#Region '.\Private\moduleSettings\Remove-DattoModuleSettings.ps1' 0 +function Remove-DattoModuleSettings { +<# + .SYNOPSIS + Removes the stored Datto configuration folder. + + .DESCRIPTION + The Remove-DattoModuleSettings cmdlet removes the Datto folder and its files. + This cmdlet also has the option to remove sensitive Datto variables as well. + + By default configuration files are stored in the following location and will be removed: + $env:USERPROFILE\DattoAPI + + .PARAMETER dattoConfPath + Define the location of the Datto configuration folder. + + By default the configuration folder is located at: + $env:USERPROFILE\DattoAPI + + .PARAMETER andVariables + Define if sensitive Datto variables should be removed as well. + + By default the variables are not removed. + + .EXAMPLE + Remove-DattoModuleSettings + + Checks to see if the default configuration folder exists and removes it if it does. + + The default location of the Datto configuration folder is: + $env:USERPROFILE\DattoAPI + + .EXAMPLE + Remove-DattoModuleSettings -DattoConfPath C:\DattoAPI -andVariables + + Checks to see if the defined configuration folder exists and removes it if it does. + If sensitive Datto variables exist then they are removed as well. + + The location of the Datto configuration folder in this example is: + C:\DattoAPI + + .NOTES + N\A + + .LINK + https://celerium.github.io/Datto-PowerShellWrapper/site/Internal/Remove-DattoModuleSettings.html +#> + + [CmdletBinding(SupportsShouldProcess, DefaultParameterSetName = 'set')] + Param ( + [Parameter(ParameterSetName = 'set')] + [string]$dattoConfPath = $(Join-Path -Path $home -ChildPath $(if ($IsWindows -or $PSEdition -eq 'Desktop'){"DattoAPI"}else{".DattoAPI"}) ), + + [Parameter(ParameterSetName = 'set')] + [switch]$andVariables + ) + + begin {} + + process { + + if (Test-Path $dattoConfPath) { + + Remove-Item -Path $dattoConfPath -Recurse -Force -WhatIf:$WhatIfPreference + + If ($andVariables) { + Remove-DattoAPIKey + Remove-DattoBaseURI + } + + if (!(Test-Path $dattoConfPath)) { + Write-Output "The DattoAPI configuration folder has been removed successfully from [ $dattoConfPath ]" + } + else { + Write-Error "The DattoAPI configuration folder could not be removed from [ $dattoConfPath ]" + } + + } + else { + Write-Warning "No configuration folder found at [ $dattoConfPath ]" + } + + } + + end {} + +} +#EndRegion '.\Private\moduleSettings\Remove-DattoModuleSettings.ps1' 87 +#Region '.\Public\BCDR\Get-DattoAgent.ps1' 0 +function Get-DattoAgent { +<# + .SYNOPSIS + Get Datto BCDR agents from a given device + + .DESCRIPTION + The Get-DattoAgent cmdlet get agents from a given BCDR device + + /bcdr/Agent - Does not return data + /bcdr/device/serialNumber/Asset/Agent + + Can also gets a list of your clients and the agents under those clients. + As of 2022-04 this endpoint does not return any data. + + .PARAMETER serialNumber + Defines the BCDR serial number to get agents from + + The parameter is mandatory + + .PARAMETER page + Defines the page number to return + + The default value is 1 + + .PARAMETER perPage + Defines the amount of items to return with each page + + The default value is 100 + + .PARAMETER allPages + Returns all items from an endpoint + + When using this parameter there is no need to use either the page or perPage + parameters + + .EXAMPLE + Get-DattoAgent + + Gets a list of clients and the agents under those clients. + + As of 2022-04 this endpoint does not return any data. + Leaving this here in the event Datto corrects this endpoint. + + .EXAMPLE + Get-DattoAgent -serialNumber "12345678" + + Returns the agents from the defined Datto BCDR + + .EXAMPLE + Get-DattoAgent -serialNumber "12345678" -page 2 -perPage 10 + + Returns the first 10 agents from page 2 from the defined Datto BCDR + + .NOTES + The /agent uri does NOT return any data as this appears to be a deprecated endpoint in the Datto API. + The /asset/agent DOES return data. + + .LINK + https://celerium.github.io/Datto-PowerShellWrapper/site/BCDR/Get-DattoAgent.html +#> + + [CmdletBinding(DefaultParameterSetName = 'index')] + Param ( + [Parameter(Mandatory = $true, ValueFromPipeline = $true, ParameterSetName = 'indexByDevice')] + [ValidateNotNullOrEmpty()] + [string]$serialNumber, + + [Parameter(Mandatory = $false, ParameterSetName = 'index')] + [Parameter(Mandatory = $false, ParameterSetName = 'indexByDevice')] + [ValidateRange(1, [Int64]::MaxValue)] + [Int64]$page = 1, + + [Parameter(Mandatory = $false, ParameterSetName = 'index')] + [Parameter(Mandatory = $false, ParameterSetName = 'indexByDevice')] + [ValidateRange(1, [Int64]::MaxValue)] + [Int64]$perPage = 100, + + [Parameter( Mandatory = $false)] + [Switch]$allPages + ) + + begin { + + switch ( [bool]$serialNumber ) { + $true { $resource_uri = "/bcdr/device/$serialNumber/asset/agent" } + $false { $resource_uri = "/bcdr/agent" } + } + + } + + process { + + Write-Verbose "Running the [ $($PSCmdlet.ParameterSetName) ] parameterSet" + + #Add default PSBoundParameters + if( -not $PSBoundParameters.ContainsKey('page') ) { $PSBoundParameters._page = 1 } + else { $PSBoundParameters._page = $page } + + if( -not $PSBoundParameters.ContainsKey('perPage') ) { $PSBoundParameters._perPage = 100 } + else { $PSBoundParameters._perPage = $perPage } + + Set-Variable -Name 'Datto_agentParameters' -Value $PSBoundParameters -Scope Global -Force + + switch ($allPages) { + $true { Invoke-DattoRequest -method GET -resource_Uri $resource_Uri -uri_Filter $PSBoundParameters -allPages } + $false { Invoke-DattoRequest -method GET -resource_Uri $resource_Uri -uri_Filter $PSBoundParameters } + } + + } + + end {} + +} +#EndRegion '.\Public\BCDR\Get-DattoAgent.ps1' 114 +#Region '.\Public\BCDR\Get-DattoAlert.ps1' 0 +function Get-DattoAlert { +<# + .SYNOPSIS + Gets Datto BCDR alerts for a given device. + + .DESCRIPTION + The Get-DattoAlert cmdlet gets Datto BCDR alerts for a given device. + + .PARAMETER serialNumber + Defines the BCDR serial number to get + + The parameter is mandatory + + .PARAMETER page + Defines the page number to return + + The default value is 1 + + .PARAMETER perPage + Defines the amount of items to return with each page + + The default value is 100 + + .PARAMETER allPages + Returns all items from an endpoint + + When using this parameter there is no need to use either the page or perPage + parameters + + .EXAMPLE + Get-DattoAlert -serialNumber "12345678" + + Gets the Datto BCDR with the defined serialNumber and returns any alerts. + + .EXAMPLE + Get-DattoAlert -serialNumber "12345678" -page 2 -pageSize 10 + + Gets the Datto BCDR with the defined serialNumber + with the first 10 alerts from the 2nd page of results. + + .NOTES + PerPage always gets set to 100 regardless of value, appears this is not + a valid parameter for this endpoint. + + .LINK + https://celerium.github.io/Datto-PowerShellWrapper/site/BCDR/Get-DattoAlert.html +#> + + [CmdletBinding(DefaultParameterSetName = 'index')] + Param ( + [Parameter(Mandatory = $true, ValueFromPipeline = $true, ParameterSetName = 'index')] + [ValidateNotNullOrEmpty()] + [string]$serialNumber, + + [Parameter(Mandatory = $false, ParameterSetName = 'index')] + [ValidateRange(1, [Int64]::MaxValue)] + [Int64]$page = 1, + + [Parameter(Mandatory = $false, ParameterSetName = 'index')] + [ValidateRange(1, [Int64]::MaxValue)] + [Int64]$perPage = 100, + + [Parameter( Mandatory = $false, ParameterSetName = 'index')] + [Switch]$allPages + ) + + begin { + + $resource_uri = "/bcdr/device/$serialNumber/alert" + + } + + process { + + Write-Verbose "Running the [ $($PSCmdlet.ParameterSetName) ] parameterSet" + + #Add default PSBoundParameters + if( -not $PSBoundParameters.ContainsKey('page') ) { $PSBoundParameters._page = 1 } + else { $PSBoundParameters._page = $page } + + if( -not $PSBoundParameters.ContainsKey('perPage') ) { $PSBoundParameters._perPage = 100 } + else { $PSBoundParameters._perPage = $perPage } + + Set-Variable -Name 'Datto_alertParameters' -Value $PSBoundParameters -Scope Global -Force + + switch ($allPages) { + $true { Invoke-DattoRequest -method GET -resource_Uri $resource_Uri -uri_Filter $PSBoundParameters -allPages } + $false { Invoke-DattoRequest -method GET -resource_Uri $resource_Uri -uri_Filter $PSBoundParameters } + } + + } + + end {} + +} +#EndRegion '.\Public\BCDR\Get-DattoAlert.ps1' 96 +#Region '.\Public\BCDR\Get-DattoAsset.ps1' 0 +function Get-DattoAsset { +<# + .SYNOPSIS + Get Datto BCDR assets (agents and shares) for a given device + + .DESCRIPTION + The Get-DattoAsset cmdlet gets Datto BCDR assets (agents and shares) + for a given device + + .PARAMETER serialNumber + Defines the BCDR serial number to get + + The parameter is mandatory + + .PARAMETER page + Defines the page number to return + + The default value is 1 + + .PARAMETER perPage + Defines the amount of items to return with each page + + The default value is 100 + + .PARAMETER allPages + Returns all items from an endpoint + + When using this parameter there is no need to use either the page or perPage + parameters + + .EXAMPLE + Get-DattoAsset -serialNumber "12345678" + + Gets the Datto BCDR with the defined serialNumber and returns any agents or shares. + + .EXAMPLE + Get-DattoAsset -serialNumber "12345678" -page 2 -pageSize 10 + + Gets the Datto BCDR with the defined serialNumber and returns + the first 10 agents or shares from the 2nd page of results. + + .NOTES + N\A + + .LINK + https://celerium.github.io/Datto-PowerShellWrapper/site/BCDR/Get-DattoAsset.html +#> + + [CmdletBinding(DefaultParameterSetName = 'index')] + Param ( + [Parameter(Mandatory = $true, ValueFromPipeline = $true, ParameterSetName = 'index')] + [ValidateNotNullOrEmpty()] + [string]$serialNumber, + + [Parameter(Mandatory = $false, ParameterSetName = 'index')] + [ValidateRange(1, [Int64]::MaxValue)] + [Int64]$page = 1, + + [Parameter(Mandatory = $false, ParameterSetName = 'index')] + [ValidateRange(1, [Int64]::MaxValue)] + [Int64]$perPage = 100, + + [Parameter( Mandatory = $false, ParameterSetName = 'index')] + [Switch]$allPages + ) + + begin { + + $resource_uri = "/bcdr/device/$serialNumber/asset" + + } + + process { + + Write-Verbose "Running the [ $($PSCmdlet.ParameterSetName) ] parameterSet" + + #Add default PSBoundParameters + if( -not $PSBoundParameters.ContainsKey('page') ) { $PSBoundParameters._page = 1 } + else { $PSBoundParameters._page = $page } + + if( -not $PSBoundParameters.ContainsKey('perPage') ) { $PSBoundParameters._perPage = 100 } + else { $PSBoundParameters._perPage = $perPage } + + Set-Variable -Name 'Datto_assetParameters' -Value $PSBoundParameters -Scope Global -Force + + switch ($allPages) { + $true { Invoke-DattoRequest -method GET -resource_Uri $resource_Uri -uri_Filter $PSBoundParameters -allPages } + $false { Invoke-DattoRequest -method GET -resource_Uri $resource_Uri -uri_Filter $PSBoundParameters } + } + + } + + end {} + +} +#EndRegion '.\Public\BCDR\Get-DattoAsset.ps1' 96 +#Region '.\Public\BCDR\Get-DattoBCDR.ps1' 0 +function Get-DattoBCDR { +<# + .SYNOPSIS + Gets Datto BCDR devices and assets + + .DESCRIPTION + The Get-DattoBCDR cmdlet gets Datto BCDR devices and assets by combing all endpoints + into a single command. + + This unique function does not contain any Reporting or SaaS endpoints. This function + was added to simply testing & generating reports + + .PARAMETER endpoint_Agents + Returns a list of BCDR clients and the agents under those clients + + As of 2022-04 this endpoint always returns no data + + Endpoint = /bcdr/agent + + .PARAMETER endpoint_Devices + Returns a list of BCDR devices registered under your portal + + Endpoint = /bcdr/device + + .PARAMETER endpoint_byDevice + Returns a single BCDR device registered under your portal + + Endpoint = /bcdr/device/{serialNumber} + + .PARAMETER endpoint_byDeviceAgent + Returns a list BCDR agents from a given device + + Endpoint = /bcdr/device/{serialNumber}/asset/agent + + .PARAMETER endpoint_byDeviceAlert + Returns a list BCDR alerts from a given device + + Endpoint = /bcdr/device/{serialNumber}/alert + + .PARAMETER endpoint_byDeviceAsset + Returns a list BCDR agents & shares from a given device + + Endpoint = /bcdr/device/{serialNumber}/asset + + .PARAMETER endpoint_byDeviceShare + Returns a list BCDR shares from a given device + + Endpoint = /bcdr/device/{serialNumber}/asset/share + + .PARAMETER endpoint_byDeviceVolume + Returns a list BCDR volumes from a given device + + Endpoint = /bcdr/device/{serialNumber}/asset/volume + + .PARAMETER serialNumber + Defines the BCDR serial number to get information from + + The parameter is mandatory if you want to get a specific device. + + .PARAMETER showHiddenDevices + Whether hidden devices should be included in your results + + Acceptable values are: + '0', '1' + + By default '1' is returned by the API which shows hidden devices. + + .PARAMETER showChildResellerDevices + Whether child reseller devices should be included in your results + + Acceptable values are: + '0', '1' + + By default '1' is returned by the API which shows child reseller devices. + + .PARAMETER volumeName + Gets an asset(s)(agent or share) for a specific volume on a device + + .PARAMETER page + Defines the page number to return + + The default value is 1 + + .PARAMETER perPage + Defines the amount of items to return with each page + + The default value is 100 + + .PARAMETER allPages + Returns all items from an endpoint + + When using this parameter there is no need to use either the page or perPage + parameters + + .EXAMPLE + Get-DattoBCDR + + Gets the first 100 Datto BCDR devices + + This function uses the -endpoint_Devices switch by default + + .EXAMPLE + Get-DattoBCDR -endpoint_Agents -serialNumber '12345678' + + Returns a list of BCDR clients and the agents under those clients + + As of 2022-04 this endpoint always returns no data + + .EXAMPLE + Get-DattoBCDR -endpoint_byDevice -serialNumber '12345678' + + Returns a single BCDR device registered under your portal + + .EXAMPLE + Get-DattoBCDR -endpoint_byDeviceAgent -serialNumber '12345678' + + Returns a list BCDR agents from a given device + + .EXAMPLE + Get-DattoBCDR -endpoint_byDeviceAlert -serialNumber '12345678' + + Returns a list BCDR alerts from a given device + + .EXAMPLE + Get-DattoBCDR -endpoint_byDeviceAsset -serialNumber '12345678' + + Returns a list BCDR agents & shares from a given device + + .EXAMPLE + Get-DattoBCDR -endpoint_byDeviceShare -serialNumber '12345678' + + Returns a list BCDR shares from a given device + + .EXAMPLE + Get-DattoBCDR -endpoint_byDeviceVolume -serialNumber '12345678' + + Returns a list BCDR volumes from a given device + + .NOTES + N\A + + .LINK + https://celerium.github.io/Datto-PowerShellWrapper/site/BCDR/Get-DattoBCDR.html +#> + + [CmdletBinding(DefaultParameterSetName = 'index_Devices')] + Param ( + [Parameter(Mandatory = $true, ParameterSetName = 'index_Agents')] + [switch]$endpoint_Agents, + + [Parameter(Mandatory = $false, ParameterSetName = 'index_Devices')] + [switch]$endpoint_Devices, + + [Parameter(Mandatory = $true, ParameterSetName = 'index_byDevice')] + [switch]$endpoint_byDevice, + + [Parameter(Mandatory = $true, ParameterSetName = 'index_byDeviceAgent')] + [switch]$endpoint_byDeviceAgent, + + [Parameter(Mandatory = $true, ParameterSetName = 'index_byDeviceAlert')] + [switch]$endpoint_byDeviceAlert, + + [Parameter(Mandatory = $true, ParameterSetName = 'index_byDeviceAsset')] + [switch]$endpoint_byDeviceAsset, + + [Parameter(Mandatory = $true, ParameterSetName = 'index_byDeviceShare')] + [switch]$endpoint_byDeviceShare, + + [Parameter(Mandatory = $true, ParameterSetName = 'index_byDeviceVolume')] + [switch]$endpoint_byDeviceVolume, + + [Parameter(Mandatory = $true, ValueFromPipeline = $true, ParameterSetName = 'index_byDevice' )] + [Parameter(Mandatory = $true, ValueFromPipeline = $true, ParameterSetName = 'index_byDeviceAgent' )] + [Parameter(Mandatory = $true, ValueFromPipeline = $true, ParameterSetName = 'index_byDeviceAlert' )] + [Parameter(Mandatory = $true, ValueFromPipeline = $true, ParameterSetName = 'index_byDeviceAsset' )] + [Parameter(Mandatory = $true, ValueFromPipeline = $true, ParameterSetName = 'index_byDeviceShare' )] + [Parameter(Mandatory = $true, ValueFromPipeline = $true, ParameterSetName = 'index_byDeviceVolume' )] + [ValidateNotNullOrEmpty()] + [string]$serialNumber, + + [Parameter(Mandatory = $false, ParameterSetName = 'index_Devices')] + [ValidateSet('0','1')] + [string]$showHiddenDevices, + + [Parameter(Mandatory = $false, ParameterSetName = 'index_Devices')] + [ValidateSet('0','1')] + [string]$showChildResellerDevices, + + [Parameter(Mandatory = $true, ParameterSetName = 'index_byDeviceVolume')] + [ValidateNotNullOrEmpty()] + [string]$volumeName, + + [Parameter(Mandatory = $false, ParameterSetName = 'index_Agents' )] + [Parameter(Mandatory = $false, ParameterSetName = 'index_Devices' )] + [Parameter(Mandatory = $false, ParameterSetName = 'index_byDeviceAgent' )] + [Parameter(Mandatory = $false, ParameterSetName = 'index_byDeviceAlert' )] + [Parameter(Mandatory = $false, ParameterSetName = 'index_byDeviceAsset' )] + [Parameter(Mandatory = $false, ParameterSetName = 'index_byDeviceShare' )] + [ValidateRange(1, [Int64]::MaxValue)] + [Int64]$page = 1, + + [Parameter(Mandatory = $false, ParameterSetName = 'index_Agents' )] + [Parameter(Mandatory = $false, ParameterSetName = 'index_Devices' )] + [Parameter(Mandatory = $false, ParameterSetName = 'index_byDeviceAgent' )] + [Parameter(Mandatory = $false, ParameterSetName = 'index_byDeviceAlert' )] + [Parameter(Mandatory = $false, ParameterSetName = 'index_byDeviceAsset' )] + [Parameter(Mandatory = $false, ParameterSetName = 'index_byDeviceShare' )] + [ValidateRange(1, [Int64]::MaxValue)] + [Int64]$perPage = 100, + + [Parameter(Mandatory = $false, ParameterSetName = 'index_Agents' )] + [Parameter(Mandatory = $false, ParameterSetName = 'index_Devices' )] + [Parameter(Mandatory = $false, ParameterSetName = 'index_byDeviceAgent' )] + [Parameter(Mandatory = $false, ParameterSetName = 'index_byDeviceAlert' )] + [Parameter(Mandatory = $false, ParameterSetName = 'index_byDeviceAsset' )] + [Parameter(Mandatory = $false, ParameterSetName = 'index_byDeviceShare' )] + [Switch]$allPages + ) + + begin { + + switch ($PSCmdlet.ParameterSetName) { + 'index_Agents' { $resource_uri = "/bcdr/agent" } + 'index_Devices' { $resource_uri = "/bcdr/device" } + 'index_byDevice' { $resource_uri = "/bcdr/device/$serialNumber" } + 'index_byDeviceAgent' { $resource_uri = "/bcdr/device/$serialNumber/asset/agent" } + 'index_byDeviceAlert' { $resource_uri = "/bcdr/device/$serialNumber/alert" } + 'index_byDeviceAsset' { $resource_uri = "/bcdr/device/$serialNumber/asset" } + 'index_byDeviceShare' { $resource_uri = "/bcdr/device/$serialNumber/asset/share" } + 'index_byDeviceVolume' { $resource_uri = "/bcdr/device/$serialNumber/asset/$volumeName" } + } + + } + + process { + + Write-Verbose "Running the [ $($PSCmdlet.ParameterSetName) ] parameterSet" + + if (($PSCmdlet.ParameterSetName -eq 'index_Agents') -or + ($PSCmdlet.ParameterSetName -eq 'index_Devices') -or + ($PSCmdlet.ParameterSetName -eq 'index_byDeviceAgent') -or + ($PSCmdlet.ParameterSetName -eq 'index_byDeviceAlert') -or + ($PSCmdlet.ParameterSetName -eq 'index_byDeviceAsset') -or + ($PSCmdlet.ParameterSetName -eq 'index_byDeviceShare')) + { + + #Add default PSBoundParameters + if( -not $PSBoundParameters.ContainsKey('page') ) { $PSBoundParameters._page = 1 } + else { $PSBoundParameters._page = $page } + + if( -not $PSBoundParameters.ContainsKey('perPage') ) { $PSBoundParameters._perPage = 100 } + else { $PSBoundParameters._perPage = $perPage } + } + + Set-Variable -Name 'Datto_bcdrParameters' -Value $PSBoundParameters -Scope Global -Force + + switch ($allPages) { + $true { Invoke-DattoRequest -method GET -resource_Uri $resource_Uri -uri_Filter $PSBoundParameters -allPages } + $false { Invoke-DattoRequest -method GET -resource_Uri $resource_Uri -uri_Filter $PSBoundParameters } + } + + } + + end {} + +} +#EndRegion '.\Public\BCDR\Get-DattoBCDR.ps1' 267 +#Region '.\Public\BCDR\Get-DattoDevice.ps1' 0 +function Get-DattoDevice { +<# + .SYNOPSIS + Gets Datto BCDR devices from the the Datto API. + + .DESCRIPTION + The Get-DattoDevice cmdlet gets can get a one or more + Datto BCDR devices. + + /bcdr/device - Returns all BCDR devices + /bcdr/device/serialNumber - Returns a single BCDR device + + .PARAMETER serialNumber + Defines the BCDR serial number to get + + The parameter is mandatory if you want to get a specific device. + + .PARAMETER showHiddenDevices + Whether hidden devices should be included in your results + + Acceptable values are: + '0', '1' + + By default '1' is returned by the API which shows hidden devices. + + .PARAMETER showChildResellerDevices + Whether child reseller devices should be included in your results + + Acceptable values are: + '0', '1' + + By default '1' is returned by the API which shows child reseller devices. + + .PARAMETER page + Defines the page number to return + + The default value is 1 + + .PARAMETER perPage + Defines the amount of items to return with each page + + The default value is 100 + + .PARAMETER allPages + Returns all items from an endpoint + + When using this parameter there is no need to use either the page or perPage + parameters + + .EXAMPLE + Get-DattoDevice + + Gets the first 100 Datto BCDR devices with any hidden or child reseller devices. + + .EXAMPLE + Get-DattoDevice -showHiddenDevices 0 -showChildResellerDevices 0 + + Gets the first 100 Datto BCDR devices without any hidden or child reseller devices. + + .EXAMPLE + Get-DattoDevice -page 2 -pageSize 10 + + Gets the first 10 Datto BCDR devices from the second page. + Hidden and child reseller devices will be included. + + .NOTES + Setting some parameters to an [INT] causes them to not be added to the body. (Show*Devices) + Documentation around the Show* endpoints just defines that an integer is accepted. + In testing only 0 or 1 appear to do anything. + + .LINK + https://celerium.github.io/Datto-PowerShellWrapper/site/BCDR/Get-DattoDevice.html +#> + + [CmdletBinding(DefaultParameterSetName = 'index')] + Param ( + [Parameter(Mandatory = $true, ValueFromPipeline = $true, ParameterSetName = 'indexByDevice')] + [ValidateNotNullOrEmpty()] + [string]$serialNumber, + + [Parameter(Mandatory = $false, ParameterSetName = 'index')] + [ValidateSet('0','1')] + [string]$showHiddenDevices, + + [Parameter(Mandatory = $false, ParameterSetName = 'index')] + [ValidateSet('0','1')] + [string]$showChildResellerDevices, + + [Parameter(Mandatory = $false, ParameterSetName = 'index')] + [ValidateRange(1, [Int64]::MaxValue)] + [Int64]$page = 1, + + [Parameter(Mandatory = $false, ParameterSetName = 'index')] + [ValidateRange(1, [Int64]::MaxValue)] + [Int64]$perPage = 100, + + [Parameter( Mandatory = $false, ParameterSetName = 'index')] + [Switch]$allPages + ) + + begin { + + switch ( [bool]$serialNumber ) { + $true { $resource_uri = "/bcdr/device/$serialNumber" } + $false { $resource_uri = "/bcdr/device" } + } + + } + + process { + + Write-Verbose "Running the [ $($PSCmdlet.ParameterSetName) ] parameterSet" + + #Add default PSBoundParameters + if( -not $PSBoundParameters.ContainsKey('page') ) { $PSBoundParameters._page = 1 } + else { $PSBoundParameters._page = $page } + + if( -not $PSBoundParameters.ContainsKey('perPage') ) { $PSBoundParameters._perPage = 100 } + else { $PSBoundParameters._perPage = $perPage } + + Set-Variable -Name 'Datto_deviceParameters' -Value $PSBoundParameters -Scope Global -Force + + switch ($allPages) { + $true { Invoke-DattoRequest -method GET -resource_Uri $resource_Uri -uri_Filter $PSBoundParameters -allPages } + $false { Invoke-DattoRequest -method GET -resource_Uri $resource_Uri -uri_Filter $PSBoundParameters } + } + + } + + end {} + +} +#EndRegion '.\Public\BCDR\Get-DattoDevice.ps1' 133 +#Region '.\Public\BCDR\Get-DattoShare.ps1' 0 +function Get-DattoShare { +<# + .SYNOPSIS + Gets Datto BCDR shares for a given device + + .DESCRIPTION + The Get-DattoShare cmdlet gets Datto BCDR shares + for a given device + + .PARAMETER serialNumber + Defines the BCDR serial number to get + + The parameter is mandatory + + .PARAMETER page + Defines the page number to return + + The default value is 1 + + .PARAMETER perPage + Defines the amount of items to return with each page + + The default value is 100 + + .PARAMETER allPages + Returns all items from an endpoint + + When using this parameter there is no need to use either the page or perPage + parameters + + .EXAMPLE + Get-DattoShare -serialNumber "12345678" + + Gets the Datto BCDR with the defined serialNumber and returns any shares. + + .EXAMPLE + Get-DattoShare -serialNumber "12345678" -page 2 -pageSize 10 + + Gets the Datto BCDR with the defined serialNumber + with the first 10 shares from the 2nd page of results. + + .NOTES + N\A + + .LINK + https://celerium.github.io/Datto-PowerShellWrapper/site/BCDR/Get-DattoShare.html +#> + + [CmdletBinding(DefaultParameterSetName = 'index')] + Param ( + [Parameter(Mandatory = $true, ValueFromPipeline = $true, ParameterSetName = 'index')] + [ValidateNotNullOrEmpty()] + [string]$serialNumber, + + [Parameter(Mandatory = $false, ParameterSetName = 'index')] + [ValidateRange(1, [Int64]::MaxValue)] + [Int64]$page = 1, + + [Parameter(Mandatory = $false, ParameterSetName = 'index')] + [ValidateRange(1, [Int64]::MaxValue)] + [Int64]$perPage = 100, + + [Parameter( Mandatory = $false, ParameterSetName = 'index')] + [Switch]$allPages + ) + + begin { + + $resource_uri = "/bcdr/device/$serialNumber/asset/share" + + } + + process { + + Write-Verbose "Running the [ $($PSCmdlet.ParameterSetName) ] parameterSet" + + #Add default PSBoundParameters + if( -not $PSBoundParameters.ContainsKey('page') ) { $PSBoundParameters._page = 1 } + else { $PSBoundParameters._page = $page } + + if( -not $PSBoundParameters.ContainsKey('perPage') ) { $PSBoundParameters._perPage = 100 } + else { $PSBoundParameters._perPage = $perPage } + + Set-Variable -Name 'Datto_assetShareParameters' -Value $PSBoundParameters -Scope Global -Force + + switch ($allPages) { + $true { Invoke-DattoRequest -method GET -resource_Uri $resource_Uri -uri_Filter $PSBoundParameters -allPages } + $false { Invoke-DattoRequest -method GET -resource_Uri $resource_Uri -uri_Filter $PSBoundParameters } + } + + } + + end {} + +} +#EndRegion '.\Public\BCDR\Get-DattoShare.ps1' 96 +#Region '.\Public\BCDR\Get-DattoVMRestore.ps1' 0 +function Get-DattoVMRestore { +<# + .SYNOPSIS + Gets Datto BCDR VM restores by serial number + + .DESCRIPTION + The Get-DattoVMRestore cmdlet gets device VM restores + by serial number + + .PARAMETER serialNumber + Defines the BCDR serial number to get + + .EXAMPLE + Get-DattoVMRestore -serialNumber 12345 + + Gest Datto VM restores from the defined device + + .NOTES + N\A + + .LINK + https://celerium.github.io/Datto-PowerShellWrapper/site/BCDR/Get-DattoVMRestore.html +#> + + [CmdletBinding(DefaultParameterSetName = 'index')] + Param ( + [Parameter(Mandatory = $true, ValueFromPipeline = $true, ParameterSetName = 'index')] + [ValidateNotNullOrEmpty()] + [string]$serialNumber + ) + + begin { + + $resource_uri = "/bcdr/device/$serialNumber/vm-restores" + + } + + process { + + Write-Verbose "Running the [ $($PSCmdlet.ParameterSetName) ] parameterSet" + + Set-Variable -Name 'Datto_VMRestoreParameters' -Value $PSBoundParameters -Scope Global -Force + + Invoke-DattoRequest -method GET -resource_Uri $resource_Uri -uri_Filter $PSBoundParameters + + } + + end {} + +} +#EndRegion '.\Public\BCDR\Get-DattoVMRestore.ps1' 51 +#Region '.\Public\BCDR\Get-DattoVolume.ps1' 0 +function Get-DattoVolume { +<# + .SYNOPSIS + Gets an asset(s)(agent or share) for a specific volume on a device + + .DESCRIPTION + The Get-DattoVolume cmdlet gets an asset(s)(agent or share) + for a specific volume on a device + + .PARAMETER serialNumber + Defines the BCDR serial number to get + + The parameter is mandatory + + .PARAMETER volumeName + Defines the name (id) of the protected volume + + The content of the 'volume' field when calling /v1/bcdr/device/{serialNumber}/asset + + The parameter is mandatory + + .EXAMPLE + Get-DattoVolume -serialNumber "12345678" -volumeName "0987654321" + + Gets the Datto BCDR with the defined serialNumber and returns any + agents or shares for the defined volume. + + .NOTES + N\A + + .LINK + https://celerium.github.io/Datto-PowerShellWrapper/site/BCDR/Get-DattoVolume.html +#> + + [CmdletBinding(DefaultParameterSetName = 'index')] + Param ( + [Parameter(Mandatory = $true, ValueFromPipeline = $true, ParameterSetName = 'index')] + [ValidateNotNullOrEmpty()] + [string]$serialNumber, + + [Parameter(Mandatory = $true, ParameterSetName = 'index')] + [ValidateNotNullOrEmpty()] + [string]$volumeName + ) + + begin { + + $resource_uri = "/bcdr/device/$serialNumber/asset/$volumeName" + + } + + process { + + Write-Verbose "Running the [ $($PSCmdlet.ParameterSetName) ] parameterSet" + + Set-Variable -Name 'Datto_assetVolumeParameters' -Value $PSBoundParameters -Scope Global -Force + + Invoke-DattoRequest -method GET -resource_Uri $resource_Uri -uri_Filter $PSBoundParameters + + } + + end {} + +} +#EndRegion '.\Public\BCDR\Get-DattoVolume.ps1' 65 +#Region '.\Public\Reporting\Get-DattoActivityLog.ps1' 0 +function Get-DattoActivityLog { +<# + .SYNOPSIS + Gets a filtered list of activity logs ordered by date + + .DESCRIPTION + The Get-DattoActivityLog cmdlet gets a filtered list of activity logs ordered by date + + .PARAMETER clientName + Defines a client name with which to do a partial/prefix match + + 2022-04: Filter does not appear to work + + .PARAMETER since + Defines the number of days (unless overridden with sinceUnits), up until now, + for which to produce logs + + Default value : 1 + + .PARAMETER sinceUnits + Defines the units to use for the since filter + + Available values : days, hours, minutes + + Default value : days + + .PARAMETER target + Defines a comma-separated array of targetType:targetId tuples + + Example: bcdr-device:DC1234DC1234 + + 2022-04: Only works with 1 item in the array right now (See Notes) + + .PARAMETER targetType + Defines the type of target for which to find activity logs + + Example : bcdr-device + + .PARAMETER user + Defines a username with which to do a partial/prefix match + + .PARAMETER page + Defines the page number to return + + The default value is 1 + + .PARAMETER perPage + Defines the amount of items to return with each page + + The default value is 100 + + .PARAMETER allPages + Returns all items from an endpoint + + When using this parameter there is no need to use either the page or perPage + parameters + + .EXAMPLE + Get-DattoActivityLog + + Gets the Datto BCDR platform activity logs from the past day. + + .EXAMPLE + Get-DattoActivityLog -since 7 -sinceUnits days + + Gets the Datto BCDR platform activity logs from the past 7 day. + + .EXAMPLE + Get-DattoActivityLog -user bob -since 7 -sinceUnits days + + Gets the Datto BCDR platform activity logs for the user named bob from the past 7 day. + + .EXAMPLE + Get-DattoActivityLog -since 30 -sinceUnits days -target 'bcdr-device:D0123456789','bcdr-device:D9876543210' + + Gets the Datto BCDR platform activity logs from the defined targets for the past 30 day. + + .EXAMPLE + Get-DattoActivityLog -since 30 -sinceUnits days -page 2 -pageSize 10 + + Gets the Datto BCDR platform activity logs from the past 30 day. + + Returns the second page of 10 items. + + .NOTES + As of 2022-04 the clientName parameter does not appear to be a working filter for this endpoint + Cannot get the filter to returned data when run from Datto's own portal as well. + + .LINK + https://celerium.github.io/Datto-PowerShellWrapper/site/Reporting/Get-DattoActivityLog.html +#> + + [CmdletBinding(DefaultParameterSetName = 'index')] + Param ( + [Parameter(Mandatory = $false, ParameterSetName = 'index')] + [ValidateNotNullOrEmpty()] + [string]$clientName, + + [Parameter(Mandatory = $false, ParameterSetName = 'index')] + [ValidateRange(1, [int]::MaxValue)] + [int]$since = 1, + + [Parameter(Mandatory = $false, ParameterSetName = 'index')] + [validateSet('days', 'hours', 'minutes')] + [string]$sinceUnits = 'days', + + [Parameter(Mandatory = $false, ParameterSetName = 'index')] + [string[]]$target, + + [Parameter(Mandatory = $false, ParameterSetName = 'index')] + [ValidateNotNullOrEmpty()] + [string]$targetType, + + [Parameter(Mandatory = $false, ParameterSetName = 'index')] + [ValidateNotNullOrEmpty()] + [string]$user, + + [Parameter(Mandatory = $false, ParameterSetName = 'index')] + [ValidateRange(1, [Int64]::MaxValue)] + [Int64]$page = 1, + + [Parameter(Mandatory = $false, ParameterSetName = 'index')] + [ValidateRange(1, [Int64]::MaxValue)] + [Int64]$perPage = 100, + + [Parameter( Mandatory = $false, ParameterSetName = 'index')] + [switch]$allPages + ) + + begin { + + $resource_uri = "/report/activity-log" + + } + + process { + + Write-Verbose "Running the [ $($PSCmdlet.ParameterSetName) ] parameterSet" + + #Add default PSBoundParameters + if( -not $PSBoundParameters.ContainsKey('page') ) { $PSBoundParameters._page = 1 } + else { $PSBoundParameters._page = $page } + + if( -not $PSBoundParameters.ContainsKey('perPage') ) { $PSBoundParameters._perPage = 100 } + else { $PSBoundParameters._perPage = $perPage } + + Set-Variable -Name 'Datto_activityLogParameters' -Value $PSBoundParameters -Scope Global -Force + + switch ($allPages) { + $true { Invoke-DattoRequest -method GET -resource_Uri $resource_Uri -uri_Filter $PSBoundParameters -allPages } + $false { Invoke-DattoRequest -method GET -resource_Uri $resource_Uri -uri_Filter $PSBoundParameters } + } + + } + + end {} + +} +#EndRegion '.\Public\Reporting\Get-DattoActivityLog.ps1' 159 +#Region '.\Public\SaaS\Get-DattoApplication.ps1' 0 +function Get-DattoApplication { +<# + .SYNOPSIS + Get Datto SaaS protection backup data for a given customer + + .DESCRIPTION + The Get-DattoApplication cmdlet gets Datto SaaS protection + backup data for a given customer + + .PARAMETER saasCustomerId + Defines the id of the customer to get SaaS information from + + The parameter is mandatory + + .EXAMPLE + Get-DattoApplication -saasCustomerId "12345678" + + Gets the Datto SaaS protection backup data from the define customer id + + .NOTES + N\A + + .LINK + https://celerium.github.io/Datto-PowerShellWrapper/site/SaaS/Get-DattoApplication.html +#> + + [CmdletBinding(DefaultParameterSetName = 'index')] + Param ( + [Parameter(Mandatory = $true, ValueFromPipeline = $true, ParameterSetName = 'index')] + [ValidateNotNullOrEmpty()] + [string]$saasCustomerId + ) + + begin { + + $resource_uri = "/saas/$saasCustomerId/applications" + + } + + process { + + Write-Verbose "Running the [ $($PSCmdlet.ParameterSetName) ] parameterSet" + + Set-Variable -Name 'Datto_applicationParameters' -Value $PSBoundParameters -Scope Global -Force + + Invoke-DattoRequest -method GET -resource_Uri $resource_Uri -uri_Filter $PSBoundParameters + + } + + end {} +} +#EndRegion '.\Public\SaaS\Get-DattoApplication.ps1' 52 +#Region '.\Public\SaaS\Get-DattoBulkSeatAssignment.ps1' 0 +function Get-DattoBulkSeatAssignment { +<# + .SYNOPSIS + Get SaaS Protection bulk seats assignment + + .DESCRIPTION + The Get-DattoBulkSeatAssignment cmdlet get SaaS Protection + bulk seats assignment + + .PARAMETER saasCustomerId + Defines the id of the customer to get SaaS information from + + .PARAMETER externalSubscriptionId + Defines the external Subscription Id of the customer to + get SaaS bulk seat information from + + .EXAMPLE + Get-DattoBulkSeatAssignment -saasCustomerId "12345678" -externalSubscriptionId 'ab23-bdf234-1234-asdf' + + Gets the Datto SaaS protection seats from the define customer id + + .NOTES + N\A + + .LINK + https://celerium.github.io/Datto-PowerShellWrapper/site/SaaS/Get-DattoBulkSeatAssignment.html +#> + + [CmdletBinding(DefaultParameterSetName = 'index')] + Param ( + [Parameter(Mandatory = $true, ValueFromPipeline = $true, ParameterSetName = 'index')] + [ValidateNotNullOrEmpty()] + [string]$saasCustomerId, + + [Parameter(Mandatory = $true, ParameterSetName = 'index')] + [ValidateNotNullOrEmpty()] + [string]$externalSubscriptionId + ) + + begin { + + $resource_uri = "/saas/$saasCustomerId/$externalSubscriptionId/bulkSeatAssignment" + + } + + process { + + Write-Verbose "Running the [ $($PSCmdlet.ParameterSetName) ] parameterSet" + + Set-Variable -Name 'Datto_bulkSeatParameters' -Value $PSBoundParameters -Scope Global -Force + + Invoke-DattoRequest -method GET -resource_Uri $resource_Uri -uri_Filter $PSBoundParameters + + } + + end {} +} +#EndRegion '.\Public\SaaS\Get-DattoBulkSeatAssignment.ps1' 58 +#Region '.\Public\SaaS\Get-DattoDomain.ps1' 0 +function Get-DattoDomain { +<# + .SYNOPSIS + Get Datto SaaS protection data about what domains are being protected + + .DESCRIPTION + The Get-DattoDomain cmdlet gets SaaS protection data + about what domains are being protected + + .EXAMPLE + Get-DattoDomain + + Gets SaaS protection data about what domains are being protected + + .NOTES + N\A + + .LINK + https://celerium.github.io/Datto-PowerShellWrapper/site/SaaS/Get-DattoDomain.html +#> + + [CmdletBinding()] + Param () + + begin { + + $resource_uri = "/saas/domains" + + } + + process { + + Write-Verbose "Running the [ $($PSCmdlet.ParameterSetName) ] parameterSet" + + Set-Variable -Name 'Datto_domainParameters' -Value $PSBoundParameters -Scope Global -Force + + Invoke-DattoRequest -method GET -resource_Uri $resource_Uri -uri_Filter $PSBoundParameters + + } + + end {} + +} +#EndRegion '.\Public\SaaS\Get-DattoDomain.ps1' 44 +#Region '.\Public\SaaS\Get-DattoSaaS.ps1' 0 +function Get-DattoSaaS { +<# + .SYNOPSIS + Gets Datto SaaS protection data + + .DESCRIPTION + The Get-DattoSaaS cmdlet gets Datto SaaS protection data by combing all endpoints + into a single command. + + This unique function does not contain any BCDR or Reporting endpoints. This function + was added to simply for testing & generating reports + + .PARAMETER endpoint_Domains + Returns SaaS protection data about what domains are being protected + + Endpoint = /SaaS/domains + + .PARAMETER endpoint_CustomerSeats + Returns SaaS protection seats for a given customer + + Endpoint = /SaaS/domains/{sassCustomerId}/seats + + .PARAMETER endpoint_CustomerApps + Returns SaaS protection backup data for a given customer + + Endpoint = /SaaS/domains/{sassCustomerId}/applications + + .PARAMETER saasCustomerId + Defines the id of the customer to get SaaS information from + + The parameter is mandatory + + .EXAMPLE + Get-DattoSaaS + + Returns SaaS protection data about what domains are being protected + + This function uses the -endpoint_Domains switch by default + + .EXAMPLE + Get-DattoSaaS -endpoint_CustomerSeats -saasCustomerId 12345678 + + Returns SaaS protection seats for a given customer + + .EXAMPLE + Get-DattoSaaS -endpoint_CustomerApps -saasCustomerId 12345678 + + Returns SaaS protection backup data for a given customer + + .NOTES + N\A + + .LINK + https://celerium.github.io/Datto-PowerShellWrapper/site/SaaS/Get-DattoSaaS.html +#> + + [CmdletBinding(DefaultParameterSetName = 'index_Domains')] + Param ( + [Parameter(Mandatory = $false, ParameterSetName = 'index_Domains')] + [switch]$endpoint_Domains, + + [Parameter(Mandatory = $true, ParameterSetName = 'index_byCustomerSeats')] + [switch]$endpoint_CustomerSeats, + + [Parameter(Mandatory = $true, ParameterSetName = 'index_byCustomerApps')] + [switch]$endpoint_CustomerApps, + + [Parameter(Mandatory = $true, ValueFromPipeline = $true, ParameterSetName = 'index_byCustomerSeats' )] + [Parameter(Mandatory = $true, ValueFromPipeline = $true, ParameterSetName = 'index_byCustomerApps' )] + [ValidateNotNullOrEmpty()] + [string]$saasCustomerId + ) + + begin { + + switch ($PSCmdlet.ParameterSetName) { + 'index_Domains' { $resource_uri = "/saas/domains" } + 'index_byCustomerSeats' { $resource_uri = "/saas/$saasCustomerId/seats" } + 'index_byCustomerApps' { $resource_uri = "/saas/$saasCustomerId/applications" } + } + + } + + process { + + Write-Verbose "Running the [ $($PSCmdlet.ParameterSetName) ] parameterSet" + + Set-Variable -Name 'Datto_bcdrParameters' -Value $PSBoundParameters -Scope Global -Force + + Invoke-DattoRequest -method GET -resource_Uri $resource_Uri -uri_Filter $PSBoundParameters + + } + + end {} + +} +#EndRegion '.\Public\SaaS\Get-DattoSaaS.ps1' 97 +#Region '.\Public\SaaS\Get-DattoSeat.ps1' 0 +function Get-DattoSeat { +<# + .SYNOPSIS + Get Datto SaaS protection seats for a given customer + + .DESCRIPTION + The Get-DattoSeat cmdlet gets Datto SaaS protection seats + for a given customer + + .PARAMETER saasCustomerId + Defines the id of the customer to get SaaS information from + + The parameter is mandatory + + .EXAMPLE + Get-DattoSeat -saasCustomerId "12345678" + + Gets the Datto SaaS protection seats from the define customer id + + .NOTES + N\A + + .LINK + https://celerium.github.io/Datto-PowerShellWrapper/site/SaaS/Get-DattoSeat.html +#> + + [CmdletBinding(DefaultParameterSetName = 'index')] + Param ( + [Parameter(Mandatory = $true, ValueFromPipeline = $true, ParameterSetName = 'index')] + [ValidateNotNullOrEmpty()] + [string]$saasCustomerId + ) + + begin { + + $resource_uri = "/saas/$saasCustomerId/seats" + + } + + process { + + Write-Verbose "Running the [ $($PSCmdlet.ParameterSetName) ] parameterSet" + + Set-Variable -Name 'Datto_seatParameters' -Value $PSBoundParameters -Scope Global -Force + + Invoke-DattoRequest -method GET -resource_Uri $resource_Uri -uri_Filter $PSBoundParameters + + } + + end {} +} +#EndRegion '.\Public\SaaS\Get-DattoSeat.ps1' 52 diff --git a/build/DattoAPI_Built_Results.xml b/build/DattoAPI_Built_Results.xml index b566d4e..ccc51e4 100644 --- a/build/DattoAPI_Built_Results.xml +++ b/build/DattoAPI_Built_Results.xml @@ -1,41 +1,41 @@  - + - + - + - + - + - - - + + + - + - + - - - - - - - - - - - + + + + + + + + + + + - + - - - + + + @@ -43,46 +43,46 @@ - + - + - + - + - - - + + + - + - + - + - + - + - - + + @@ -90,31 +90,31 @@ - + - - + + - + - + - + - - + + - + @@ -126,89 +126,89 @@ - + - + - + - + - + - + - + - - + + - + - + - - - - + + + + - + - - + + - - - + + + - + - - + + - + - + - + - + - - + + - + - + - + - + @@ -217,22 +217,22 @@ - + - + - + - + - - - - + + + + @@ -245,16 +245,16 @@ - + - + - + - - - + + + @@ -270,14 +270,14 @@ - + - + - - - + + + @@ -285,101 +285,101 @@ - + - + - + - + - - + + - + - + - - + + - + - - + + - + - + - + - - + + - - + + - + - + - + - - + + - - + + - + - - - - + + + + - - + + - + - + - + - + - + - + @@ -387,30 +387,55 @@ - + - + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - + + + - + - - + + @@ -418,17 +443,17 @@ - + - + - - - - + + + + @@ -438,19 +463,19 @@ - + - + - - + + - + - + - + @@ -463,52 +488,52 @@ - + - + - + - + - + - - + + - + - + - + - + - - + + - + - - - + + + - + @@ -519,45 +544,45 @@ - + - + - + - - - + + + - + - + - + - + - - + + - + - - + + @@ -571,19 +596,43 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + @@ -596,49 +645,49 @@ - + - + - + - + - + - + - + - - + + - + - + - + - - + + - - + + - - + + @@ -650,65 +699,65 @@ - + - + - - + + - + - - + + - + - + - + - - + + - + - - + + - + - + - + - + - + - + - + - + @@ -716,25 +765,25 @@ - + - + - + - + - + - + - - + + @@ -745,1236 +794,1236 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -1985,33 +2034,33 @@ - + - + - + - - - + + + - + - + - + - - - + + + - - + + @@ -2019,15 +2068,15 @@ - + - + - + - - + + @@ -2035,137 +2084,137 @@ - + - + - + - + - + - + - + - - - - - - - - + + + + + + + + - + - + - - - - - + + + + + - + - + - - + + - + - + - + - - - + + + - + - + - + - - + + - + - + - + - - - + + + - + - + - + - - + + - + - + - + - - - + + + diff --git a/build/DattoAPI_notBuilt_Results.xml b/build/DattoAPI_notBuilt_Results.xml index 43ce412..0c35a53 100644 --- a/build/DattoAPI_notBuilt_Results.xml +++ b/build/DattoAPI_notBuilt_Results.xml @@ -1,92 +1,92 @@  - + - + - + - + - + - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + - + - - - - + + + + - + - + - + - + - - - + + + - + - - + + - + - - - + + + - + - + - - - - - - - + + + + + + + - + @@ -101,16 +101,16 @@ - + - + - - - - + + + + - + @@ -126,15 +126,15 @@ - + - + - + - + @@ -142,9 +142,9 @@ - + - + @@ -152,35 +152,35 @@ - + - + - - + + - + - - + + - - - + + + - - - - - + + + + + - + - - + + @@ -188,27 +188,27 @@ - + - + - + - - + + - + - + - + - + @@ -217,17 +217,17 @@ - + - + - + - + - + @@ -235,29 +235,29 @@ - + - + - + - + - + - + - + @@ -270,19 +270,19 @@ - + - + - + - - - - + + + + - + @@ -294,45 +294,45 @@ - + - + - + - + - - + + - - + + - + - - + + - + - + - - - - + + + + - + @@ -342,44 +342,44 @@ - + - + - + - - + + - - + + - + - + - + - + - - - - + + + + - + - + - + - + @@ -387,75 +387,100 @@ - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - - + + - + - + - + - + - + - - + + - + - + - + - + - + - + - + - + - + @@ -463,16 +488,16 @@ - + - + - - + + @@ -480,38 +505,38 @@ - + - - + + - + - + - - + + - + - - + + - + - + - + @@ -519,51 +544,51 @@ - + - + - + - - + + - - + + - + - + - + - + - + - - + + - - + + - + - + @@ -571,48 +596,72 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + - + - - + + - + - - + + - + - + - + - + - - + + - + - - + + - - + + - + @@ -622,45 +671,45 @@ - + - + - - - + + + - - + + - - - - + + + + - + - + - + - + - + - + - - + + @@ -670,43 +719,43 @@ - + - + - - - - + + + + - - - + + + - + - + - + - - + + - + - + - - + + - + @@ -716,15 +765,15 @@ - + - + - - + + - + @@ -745,292 +794,292 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -1039,497 +1088,497 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -1538,3685 +1587,3685 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -5225,1275 +5274,1275 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -6502,542 +6551,542 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -7046,623 +7095,623 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -7671,3595 +7720,3595 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -11268,6664 +11317,7901 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + PSInvalidOperationException: The WriteObject and WriteError methods cannot be called from outside the overrides of the BeginProcessing, ProcessRecord, and EndProcessing methods, and they can only be called from within the same thread. Validate that the cmdlet makes these calls correctly, or contact Microsoft Customer Support Services. + at <ScriptBlock>, C:\Celerium\Projects\_API\Datto-PowerShellWrapper\tests\PSScriptAnalyzer.tests.ps1:147 + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + [0] Expected 0, but got 2. -[1] Expected 'DattoAPI.psd1 - 111', but got 111. +[1] Expected 'DattoAPI.psd1 - 113', but got 113. [2] Expected strings to be the same, but they were different. Expected length: 19 Actual length: 94 Strings differ at index 1. -Expected: 'DattoAPI.psd1 - 111' +Expected: 'DattoAPI.psd1 - 113' But was: 'Do not use wildcard or $null in this field. Explicitly specify a list for FunctionsToExport. ' -^ -[3] Expected 'DattoAPI.psd1 - 120', but got 120. +[3] Expected 'DattoAPI.psd1 - 122', but got 122. [4] Expected strings to be the same, but they were different. Expected length: 19 Actual length: 92 Strings differ at index 1. -Expected: 'DattoAPI.psd1 - 120' +Expected: 'DattoAPI.psd1 - 122' But was: 'Do not use wildcard or $null in this field. Explicitly specify a list for AliasesToExport. ' -^ [0] at ($invoke_Results | Measure-Object).Count | Should -Be 0, C:\Celerium\Projects\_API\Datto-PowerShellWrapper\tests\PSScriptAnalyzer.tests.ps1:149 @@ -17944,92 +19230,92 @@ at <ScriptBlock>, C:\Celerium\Projects\_API\Datto-PowerShellWrapper\tests\ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -18038,304 +19324,304 @@ at <ScriptBlock>, C:\Celerium\Projects\_API\Datto-PowerShellWrapper\tests\ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -18344,250 +19630,250 @@ at <ScriptBlock>, C:\Celerium\Projects\_API\Datto-PowerShellWrapper\tests\ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -18596,7 +19882,7 @@ at <ScriptBlock>, C:\Celerium\Projects\_API\Datto-PowerShellWrapper\tests\ - + @@ -18605,38 +19891,38 @@ at <ScriptBlock>, C:\Celerium\Projects\_API\Datto-PowerShellWrapper\tests\ - + - + - + - + - + - + - + - + - + - + - + - + @@ -18647,187 +19933,187 @@ at <ScriptBlock>, C:\Celerium\Projects\_API\Datto-PowerShellWrapper\tests\ - + - + - + - - - + + + - + - + - + - - - - - - - + + + + + + + - + - + - + - - - - + + + + - + - + - + - + - + - + - + - - - - - - - - + + + + + + + + - + - + - + - - - - - + + + + + - + - + - + - - + + - + - + - + - - - + + + - + - + - + - - + + - + - + - + - - - + + + - + - + - + - - + + - + - + - + - - - + + + diff --git a/docs/DattoAPI.md b/docs/DattoAPI.md index e70d953..056ad56 100644 --- a/docs/DattoAPI.md +++ b/docs/DattoAPI.md @@ -48,6 +48,9 @@ Shows the Datto base URI global variable. ### [Get-DattoBCDR](site/BCDR/Get-DattoBCDR.md) Gets Datto BCDR devices and assets +### [Get-DattoBulkSeatAssignment](site/SaaS/Get-DattoBulkSeatAssignment.md) +Get SaaS Protection bulk seats assignment + ### [Get-DattoDevice](site/BCDR/Get-DattoDevice.md) Gets Datto BCDR devices from the the Datto API. @@ -69,6 +72,9 @@ Get Datto SaaS protection seats for a given customer ### [Get-DattoShare](site/BCDR/Get-DattoShare.md) Gets Datto BCDR shares for a given device +### [Get-DattoVMRestore](site/BCDR/Get-DattoVMRestore.md) +Gets Datto BCDR VM restores by serial number + ### [Get-DattoVolume](site/BCDR/Get-DattoVolume.md) Gets an asset(s)(agent or share) for a specific volume on a device diff --git a/docs/Endpoints.csv b/docs/Endpoints.csv index ee974a1..5bd62de 100644 --- a/docs/Endpoints.csv +++ b/docs/Endpoints.csv @@ -7,6 +7,7 @@ BCDR,/bcdr/,GET,Get-DattoBCDR,YES,Special command that combines all BCDR endpoin BCDR,/bcdr/device,GET,Get-DattoDevice,YES, BCDR,/bcdr/device/{serialNumber},GET,Get-DattoDevice,YES, BCDR,/bcdr/device/{serialNumber}/asset/share,GET,Get-DattoShare,YES, +BCDR,/bcdr/device/{serialNumber}/vm-restores,GET,Get-DattoVMRestore,Yes,Cannot fully validate at this time BCDR,/bcdr/device/{serialNumber}/asset/{volumeName},GET,Get-DattoVolume,YES, Internal,,POST,Add-DattoAPIKey,YES, Internal,,POST,Add-DattoBaseURI,YES, @@ -14,6 +15,7 @@ Internal,,PUT,ConvertTo-DattoQueryString,YES, Internal,,GET,Export-DattoModuleSettings,YES, Internal,,GET,Get-DattoAPIKey,YES, Internal,,GET,Get-DattoBaseURI,YES, +Internal,,GET,Get-DattoMetaData,YES, Internal,,GET,Get-DattoModuleSettings,YES, Internal,,GET,Import-DattoModuleSettings,YES, Internal,,GET,Invoke-DattoRequest,YES, @@ -21,9 +23,9 @@ Internal,,DELETE,Remove-DattoAPIKey,YES, Internal,,DELETE,Remove-DattoBaseURI,YES, Internal,,DELETE,Remove-DattoModuleSettings,YES, Internal,,GET,Test-DattoAPIKey,YES, -Internal,,GET,Get-DattoMetaData,YES, Reporting,/report/activity-log,GET,Get-DattoActivityLog,YES, SaaS,/sass/{sassCustomerId}/applications,GET,Get-DattoApplication,YES, +SaaS,/saas/{saasCustomerId}/{externalSubscriptionId}/bulkSeatAssignment,GET,Get-DattoBulkSeatAssignment,YES,Cannot fully validate at this time SaaS,/sass/domains,GET,Get-DattoDomain,YES, SaaS,/sass/,GET,Get-DattoSaaS,YES,Special command that combines all SaaS endpoints SaaS,/sass/{sassCustomerId}/seats,GET,Get-DattoSeat,YES, diff --git a/docs/cab/DattoAPI_d536355d-2a81-444f-9e08-9eeeda6db819_en-US_HelpContent.cab b/docs/cab/DattoAPI_d536355d-2a81-444f-9e08-9eeeda6db819_en-US_HelpContent.cab index c3d6d15..17b7f8d 100644 Binary files a/docs/cab/DattoAPI_d536355d-2a81-444f-9e08-9eeeda6db819_en-US_HelpContent.cab and b/docs/cab/DattoAPI_d536355d-2a81-444f-9e08-9eeeda6db819_en-US_HelpContent.cab differ diff --git a/docs/cab/DattoAPI_d536355d-2a81-444f-9e08-9eeeda6db819_en-US_HelpContent.zip b/docs/cab/DattoAPI_d536355d-2a81-444f-9e08-9eeeda6db819_en-US_HelpContent.zip index 7168694..6e79f4a 100644 Binary files a/docs/cab/DattoAPI_d536355d-2a81-444f-9e08-9eeeda6db819_en-US_HelpContent.zip and b/docs/cab/DattoAPI_d536355d-2a81-444f-9e08-9eeeda6db819_en-US_HelpContent.zip differ diff --git a/docs/en-US/DattoAPI-help.xml b/docs/en-US/DattoAPI-help.xml index d67d4f6..e25d78e 100644 --- a/docs/en-US/DattoAPI-help.xml +++ b/docs/en-US/DattoAPI-help.xml @@ -1712,6 +1712,72 @@ + + + Get-DattoVMRestore + Get + DattoVMRestore + + Gets Datto BCDR VM restores by serial number + + + + The Get-DattoVMRestore cmdlet gets device VM restores by serial number + + + + Get-DattoVMRestore + + serialNumber + + Defines the BCDR serial number to get + + String + + String + + + None + + + + + + serialNumber + + Defines the BCDR serial number to get + + String + + String + + + None + + + + + + + N\A + + + + + -------------------------- EXAMPLE 1 -------------------------- + Get-DattoVMRestore -serialNumber 12345 + + Gest Datto VM restores from the defined device + + + + + + https://celerium.github.io/Datto-PowerShellWrapper/site/BCDR/Get-DattoVMRestore.html + https://celerium.github.io/Datto-PowerShellWrapper/site/BCDR/Get-DattoVMRestore.html + + + Get-DattoVolume @@ -3591,6 +3657,96 @@ + + + Get-DattoBulkSeatAssignment + Get + DattoBulkSeatAssignment + + Get SaaS Protection bulk seats assignment + + + + The Get-DattoBulkSeatAssignment cmdlet get SaaS Protection bulk seats assignment + + + + Get-DattoBulkSeatAssignment + + saasCustomerId + + Defines the id of the customer to get SaaS information from + + String + + String + + + None + + + externalSubscriptionId + + Defines the external Subscription Id of the customer to get SaaS bulk seat information from + + String + + String + + + None + + + + + + saasCustomerId + + Defines the id of the customer to get SaaS information from + + String + + String + + + None + + + externalSubscriptionId + + Defines the external Subscription Id of the customer to get SaaS bulk seat information from + + String + + String + + + None + + + + + + + N\A + + + + + -------------------------- EXAMPLE 1 -------------------------- + Get-DattoBulkSeatAssignment -saasCustomerId "12345678" -externalSubscriptionId 'ab23-bdf234-1234-asdf' + + Gets the Datto SaaS protection seats from the define customer id + + + + + + https://celerium.github.io/Datto-PowerShellWrapper/site/SaaS/Get-DattoBulkSeatAssignment.html + https://celerium.github.io/Datto-PowerShellWrapper/site/SaaS/Get-DattoBulkSeatAssignment.html + + + Get-DattoDomain diff --git a/docs/site/BCDR/Get-DattoVMRestore.md b/docs/site/BCDR/Get-DattoVMRestore.md new file mode 100644 index 0000000..11ac909 --- /dev/null +++ b/docs/site/BCDR/Get-DattoVMRestore.md @@ -0,0 +1,65 @@ +--- +external help file: DattoAPI-help.xml +grand_parent: BCDR +Module Name: DattoAPI +online version: https://celerium.github.io/Datto-PowerShellWrapper/site/BCDR/Get-DattoVMRestore.html +parent: GET +schema: 2.0.0 +title: Get-DattoVMRestore +--- + +# Get-DattoVMRestore + +## SYNOPSIS +Gets Datto BCDR VM restores by serial number + +## SYNTAX + +```powershell +Get-DattoVMRestore -serialNumber [] +``` + +## DESCRIPTION +The Get-DattoVMRestore cmdlet gets device VM restores +by serial number + +## EXAMPLES + +### EXAMPLE 1 +```powershell +Get-DattoVMRestore -serialNumber 12345 +``` + +Gest Datto VM restores from the defined device + +## PARAMETERS + +### -serialNumber +Defines the BCDR serial number to get + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +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 +N\A + +## RELATED LINKS + +[https://celerium.github.io/Datto-PowerShellWrapper/site/BCDR/Get-DattoVMRestore.html](https://celerium.github.io/Datto-PowerShellWrapper/site/BCDR/Get-DattoVMRestore.html) + diff --git a/docs/site/BCDR/index.md b/docs/site/BCDR/index.md index 5806c37..8997b4e 100644 --- a/docs/site/BCDR/index.md +++ b/docs/site/BCDR/index.md @@ -11,7 +11,7 @@ Some functions will handle more than one endpoint and the numbers below show the | **Method** | **Endpoint Count** | |------------|---------------------| | DELETE | 0 | -| GET | 9 | +| GET | 10 | | POST | 0 | | PUT | 0 | diff --git a/docs/site/SaaS/Get-DattoBulkSeatAssignment.md b/docs/site/SaaS/Get-DattoBulkSeatAssignment.md new file mode 100644 index 0000000..afe5db9 --- /dev/null +++ b/docs/site/SaaS/Get-DattoBulkSeatAssignment.md @@ -0,0 +1,81 @@ +--- +external help file: DattoAPI-help.xml +grand_parent: SaaS +Module Name: DattoAPI +online version: https://celerium.github.io/Datto-PowerShellWrapper/site/SaaS/Get-DattoBulkSeatAssignment.html +parent: GET +schema: 2.0.0 +title: Get-DattoBulkSeatAssignment +--- + +# Get-DattoBulkSeatAssignment + +## SYNOPSIS +Get SaaS Protection bulk seats assignment + +## SYNTAX + +```powershell +Get-DattoBulkSeatAssignment -saasCustomerId -externalSubscriptionId [] +``` + +## DESCRIPTION +The Get-DattoBulkSeatAssignment cmdlet get SaaS Protection +bulk seats assignment + +## EXAMPLES + +### EXAMPLE 1 +```powershell +Get-DattoBulkSeatAssignment -saasCustomerId "12345678" -externalSubscriptionId 'ab23-bdf234-1234-asdf' +``` + +Gets the Datto SaaS protection seats from the define customer id + +## PARAMETERS + +### -saasCustomerId +Defines the id of the customer to get SaaS information from + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -externalSubscriptionId +Defines the external Subscription Id of the customer to +get SaaS bulk seat information from + +```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 +N\A + +## RELATED LINKS + +[https://celerium.github.io/Datto-PowerShellWrapper/site/SaaS/Get-DattoBulkSeatAssignment.html](https://celerium.github.io/Datto-PowerShellWrapper/site/SaaS/Get-DattoBulkSeatAssignment.html) + diff --git a/docs/site/SaaS/index.md b/docs/site/SaaS/index.md index a9ac909..f2f80e8 100644 --- a/docs/site/SaaS/index.md +++ b/docs/site/SaaS/index.md @@ -11,7 +11,7 @@ Some functions will handle more than one endpoint and the numbers below show the | **Method** | **Endpoint Count** | |------------|---------------------| | DELETE | 0 | -| GET | 4 | +| GET | 5 | | POST | 0 | | PUT | 0 | diff --git a/tests/DattoAPI.Tests.ps1 b/tests/DattoAPI.Tests.ps1 index 720f995..369d6b3 100644 --- a/tests/DattoAPI.Tests.ps1 +++ b/tests/DattoAPI.Tests.ps1 @@ -178,12 +178,12 @@ Describe "Testing the [ $buildTarget ] version of [ $moduleName ] with [ $pester It "Manifest [ NestedModules ] has valid data" { switch ($buildTarget){ 'built' { ($Module.NestedModules.Name).Count | Should -Be 0 } - 'notBuilt' { ($Module.NestedModules.Name).Count | Should -Be 27 } + 'notBuilt' { ($Module.NestedModules.Name).Count | Should -Be 29 } } } It "Manifest [ FunctionsToExport ] has valid data" { - ($Module.ExportedCommands).Count | Should -Be 28 + ($Module.ExportedCommands).Count | Should -Be 30 } It "Manifest [ CmdletsToExport ] is empty" { diff --git a/tests/Public/BCDR/Get-DattoVMRestore.Tests.ps1 b/tests/Public/BCDR/Get-DattoVMRestore.Tests.ps1 new file mode 100644 index 0000000..6fb8ce3 --- /dev/null +++ b/tests/Public/BCDR/Get-DattoVMRestore.Tests.ps1 @@ -0,0 +1,123 @@ +<# + .SYNOPSIS + Pester tests for the DattoAPI PLACEHOLDER functions + + .DESCRIPTION + Pester tests for the DattoAPI PLACEHOLDER functions + + .PARAMETER moduleName + The name of the local module to import + + .PARAMETER Version + The version of the local module to import + + .PARAMETER buildTarget + Which version of the module to run tests against + + Allowed values: + 'built', 'notBuilt' + + .EXAMPLE + Invoke-Pester -Path .\Tests\Private\PLACEHOLDER\Get-DattoPlaceholder.Tests.ps1 + + Runs a pester test and outputs simple results + + .EXAMPLE + Invoke-Pester -Path .\Tests\Private\PLACEHOLDER\Get-DattoPlaceholder.Tests.ps1 -Output Detailed + + Runs a pester test and outputs detailed results + + .INPUTS + N\A + + .OUTPUTS + N\A + + .NOTES + N\A + + .LINK + https://celerium.org + +#> + +<############################################################################################ + Code +############################################################################################> +#Requires -Version 5.1 +#Requires -Modules @{ ModuleName='Pester'; ModuleVersion='5.5.0' } + +#Region [ Parameters ] + +#Available in Discovery & Run +[CmdletBinding()] +param ( + [Parameter(Mandatory = $false)] + [ValidateNotNullOrEmpty()] + [String]$moduleName = 'DattoAPI', + + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [String]$version, + + [Parameter(Mandatory=$true)] + [ValidateSet('built','notBuilt')] + [string]$buildTarget +) + +#EndRegion [ Parameters ] + +#Region [ Prerequisites ] + +#Available inside It but NOT Describe or Context + BeforeAll { + + if ($IsWindows -or $PSEdition -eq 'Desktop') { + $rootPath = "$( $PSCommandPath.Substring(0, $PSCommandPath.IndexOf('\tests', [System.StringComparison]::OrdinalIgnoreCase)) )" + } + else{ + $rootPath = "$( $PSCommandPath.Substring(0, $PSCommandPath.IndexOf('/tests', [System.StringComparison]::OrdinalIgnoreCase)) )" + } + + switch ($buildTarget){ + 'built' { $modulePath = Join-Path -Path $rootPath -ChildPath "\build\$moduleName\$version" } + 'notBuilt' { $modulePath = Join-Path -Path $rootPath -ChildPath "$moduleName" } + } + + if (Get-Module -Name $moduleName){ + Remove-Module -Name $moduleName -Force + } + + $modulePsd1 = Join-Path -Path $modulePath -ChildPath "$moduleName.psd1" + + Import-Module -Name $modulePsd1 -ErrorAction Stop -ErrorVariable moduleError *> $null + + if ($moduleError){ + $moduleError + exit 1 + } + + } + + AfterAll{ + + if (Get-Module -Name $moduleName){ + Remove-Module -Name $moduleName -Force + } + + } + + +#EndRegion [ Prerequisites ] + +Describe "Testing [ $commandName ] function with [ $pester_TestName ]" -Tag @('PLACEHOLDER') { + + Context "[ $commandName ] testing function" { + + It "PLACEHOLDER" { + $false | Should -BeTrue + } + + } + +} \ No newline at end of file diff --git a/tests/Public/SaaS/Get-DattoBulkSeatAssignment.Tests.ps1 b/tests/Public/SaaS/Get-DattoBulkSeatAssignment.Tests.ps1 new file mode 100644 index 0000000..6fb8ce3 --- /dev/null +++ b/tests/Public/SaaS/Get-DattoBulkSeatAssignment.Tests.ps1 @@ -0,0 +1,123 @@ +<# + .SYNOPSIS + Pester tests for the DattoAPI PLACEHOLDER functions + + .DESCRIPTION + Pester tests for the DattoAPI PLACEHOLDER functions + + .PARAMETER moduleName + The name of the local module to import + + .PARAMETER Version + The version of the local module to import + + .PARAMETER buildTarget + Which version of the module to run tests against + + Allowed values: + 'built', 'notBuilt' + + .EXAMPLE + Invoke-Pester -Path .\Tests\Private\PLACEHOLDER\Get-DattoPlaceholder.Tests.ps1 + + Runs a pester test and outputs simple results + + .EXAMPLE + Invoke-Pester -Path .\Tests\Private\PLACEHOLDER\Get-DattoPlaceholder.Tests.ps1 -Output Detailed + + Runs a pester test and outputs detailed results + + .INPUTS + N\A + + .OUTPUTS + N\A + + .NOTES + N\A + + .LINK + https://celerium.org + +#> + +<############################################################################################ + Code +############################################################################################> +#Requires -Version 5.1 +#Requires -Modules @{ ModuleName='Pester'; ModuleVersion='5.5.0' } + +#Region [ Parameters ] + +#Available in Discovery & Run +[CmdletBinding()] +param ( + [Parameter(Mandatory = $false)] + [ValidateNotNullOrEmpty()] + [String]$moduleName = 'DattoAPI', + + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [String]$version, + + [Parameter(Mandatory=$true)] + [ValidateSet('built','notBuilt')] + [string]$buildTarget +) + +#EndRegion [ Parameters ] + +#Region [ Prerequisites ] + +#Available inside It but NOT Describe or Context + BeforeAll { + + if ($IsWindows -or $PSEdition -eq 'Desktop') { + $rootPath = "$( $PSCommandPath.Substring(0, $PSCommandPath.IndexOf('\tests', [System.StringComparison]::OrdinalIgnoreCase)) )" + } + else{ + $rootPath = "$( $PSCommandPath.Substring(0, $PSCommandPath.IndexOf('/tests', [System.StringComparison]::OrdinalIgnoreCase)) )" + } + + switch ($buildTarget){ + 'built' { $modulePath = Join-Path -Path $rootPath -ChildPath "\build\$moduleName\$version" } + 'notBuilt' { $modulePath = Join-Path -Path $rootPath -ChildPath "$moduleName" } + } + + if (Get-Module -Name $moduleName){ + Remove-Module -Name $moduleName -Force + } + + $modulePsd1 = Join-Path -Path $modulePath -ChildPath "$moduleName.psd1" + + Import-Module -Name $modulePsd1 -ErrorAction Stop -ErrorVariable moduleError *> $null + + if ($moduleError){ + $moduleError + exit 1 + } + + } + + AfterAll{ + + if (Get-Module -Name $moduleName){ + Remove-Module -Name $moduleName -Force + } + + } + + +#EndRegion [ Prerequisites ] + +Describe "Testing [ $commandName ] function with [ $pester_TestName ]" -Tag @('PLACEHOLDER') { + + Context "[ $commandName ] testing function" { + + It "PLACEHOLDER" { + $false | Should -BeTrue + } + + } + +} \ No newline at end of file